Author |
Topic: UDP (Read 1212 times) |
|
Gary
Guest
|
 |
UDP
« Thread started on: Dec 10th, 2010, 12:47pm » |
|
How can I send and receive UDP packets?
|
|
Logged
|
|
|
|
wizzie
New Member
member is offline


Posts: 1
|
 |
Re: UDP
« Reply #1 on: Dec 10th, 2010, 12:50pm » |
|
Good question?
Can BB4W only supprt FTP?
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: UDP
« Reply #2 on: Dec 10th, 2010, 1:21pm » |
|
on Dec 10th, 2010, 12:50pm, wizzie wrote:Can BB4W only supprt FTP? |
|
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.
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: UDP
« Reply #3 on: Dec 10th, 2010, 1:29pm » |
|
on Dec 10th, 2010, 12:47pm, Guest-Gary wrote:How can I send and receive UDP packets? |
|
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.
|
|
Logged
|
|
|
|
knudvaneeden
Developer
member is offline


Posts: 32
|
 |
Re: UDP
« Reply #4 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
|
|
Logged
|
|
|
|
Gary
Guest
|
 |
Re: UDP
« Reply #5 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.
|
|
Logged
|
|
|
|
|