BBC BASIC for Windows
Programming >> Communication and Input/Output >> UDP http://bb4w.conforums.com/index.cgi?board=communication&action=display&num=1291988842 UDP
Post by Gary on Dec 10th, 2010, 12:47pm
How can I send and receive UDP packets?
Re: UDP
Post by wizzie on Dec 10th, 2010, 12:50pm
Good question?
Can BB4W only supprt FTP?
Re: UDP
Post by admin on Dec 10th, 2010, 1:21pm
Do you mean TCP? Anyway, the answer (as always) is that BBC BASIC for Windows is a general purpose programming language, and it can do anything (within reason) that any other Windows programming language can. So, of course, it can do UDP as well as TCP.
Richard. Re: UDP
Post by admin on Dec 10th, 2010, 1:29pm
You can either write your own code, calling API functions in WSOCK32.DLL or WS2_32.DLL directly, or you can adapt the existing SOCKLIB.BBC library to open a UDP socket rather than a TCP socket.
For example in the FN_tcpconnect function you can see that the protocol is specified by passing the constant IPPROTO_TCP (6) to the socket API. By passing IPPROTO_UDP (17) instead, with perhaps a few other minor changes (like changing SOCK_STREAM to SOCK_DGRAM), you can access the UDP interface.
Ask again if you don't feel confident to make the necessary changes.
Richard.
Re: UDP
Post by knudvaneeden on Dec 14th, 2010, 08:24am
It would be very interesting to see working source code for UDP in BBCBASIC for Windows also.
Thanks.
with friendly greetings, Knud van Eeden
Re: UDP
Post by Gary on Dec 14th, 2010, 12:05pm
Thanks Ill have a go and see what I cab break(Now I have full version of BB4W ) I found WINDUMP untility so I can look at the other end of the connection to see what emerges.