PDA

View Full Version : New easy Winsock and BLUETOOTH library in 1.1.


kornalius
10-11-2006, 06:06 PM
We have worked on an easy to use library to connect to Windows Sockets and Bluetooth devices.</p>

This new library will be available in 1.1 due next month.</p>

Here are the functions we have so far:</p><pre>proc SW_UrlInit
proc SW_UrlShut
func SW_UrlOpen(address$)
proc SW_UrlClose(hUrl$)
func SW_UrlCanConnect(hUrl$)
func SW_UrlContentType(hUrl$)
func SW_UrlReceiveFile(hUrl$)
proc SW_UrlSendFile(hUrl$, data$)</pre><pre>#define _INET AF_INET
#define _BT AF_BTH</pre><pre>func SW_Socket(typ$)
proc SW_CloseSocket(socket$)
func SW_GetHostAddr(address$)
proc SW_Listen(socket$, typ$, port$)
func SW_Connect(socket$, typ$, address$, port$)
func SW_Accept(socket$)
func SW_BufferSize(socket$)
func SW_Receive(socket$, async$)
proc SW_Send(socket$, data$)</pre>

To connect to the internet using Client/Server style here is a simple client program:</p><pre>#include &quot;SWSock&quot;</pre><pre>sock$ = SW_Socket(_INET);
if (SW_Connect(sock$, &quot;myname.no-ip.com&quot;, 2342))
* Sw_Send(sock$, mydata$);
* Sw_CloseSocket(sock$);
end;</pre>

A simple server would be:</p><pre>#include &quot;SWSock&quot;</pre><pre>sock$ = SW_Socket(_INET);
if (SW_Listen(sock$, _INET, 2342))
* while (not finished$)
*** newsock$ = SW_Accept(sock$);
*** if (newsock$ != 0)
***** ShowMessage(&quot;New connection made&quot;);
***** Sw_CloseSocket(newsock$);
*** end;
* end;
* SW_CloseSocket(sock$);
end;</pre>

This library will evolve more in the future, if you have any comments or want to contribute, please use this thread.</p>

matteo.m
10-11-2006, 11:06 PM
so i could use ppl to try to connect my cellphone and read data trought bluethoot?

kornalius
10-12-2006, 03:23 AM
Yep, any bluetooth enabled device. As long as you know how to communicate with your cellphone. I think each device type has it's own bluetooth specs.

MagNet
10-12-2006, 02:38 PM
Woot!
This could be used for making BT MP games right?

kornalius
10-12-2006, 05:33 PM
Yes.

MagNet
10-12-2006, 06:06 PM
Yay!

kornalius
10-12-2006, 10:31 PM
I*have updated the main topic.</p>

It won't be released with 1.05 but with 1.1.</p>

We have to push it back a bit. 1.1 is schedule for next month (early November).</p>

MagNet
10-13-2006, 02:05 PM
Ok and... why did you change your avatar?

kornalius
10-13-2006, 02:35 PM
Because the old one was bleh! I think this one looks better and it represents the ULTIMA series, my favorite games of all time.

MagNet
10-13-2006, 11:24 PM
Oh it represents Ultima?
I guess I didn't play it long enough :D

kornalius
10-14-2006, 12:21 AM
Can you please*remove the seizure images. It is annoying for the eyes and I do not like it. I know you did it as a joke but you can post them in one message and not in your signature.

MagNet
10-14-2006, 11:31 AM
:(

kornalius
10-14-2006, 08:42 PM
Thanks Mag.

Solonn
10-26-2006, 07:49 AM
Man.... now I can't really wait for 1.1 to be out... My dream library has come true. (i hope to give them some good and heavy testing!)