Hi ImaginaryHuman,
You sure seem to know a lot about it already..
I adjusted my example a little bit.
I guess you can use one udp-socket to send and recieve. Seems obvious..
Not sure if the ports can be different or not.
Ghislain
MacIntel 10.5 - BlitzMax v1.28
You sure seem to know a lot about it already..
I adjusted my example a little bit.
I guess you can use one udp-socket to send and recieve. Seems obvious..
Not sure if the ports can be different or not.
Strict ' one udp Local Udp:tSocket = CreateUDPSocket() ' to recieve BindSocket (Udp, 49000) ' to send ConnectSocket (Udp, HostIp ("127.0.0.1"), 49000) ' Send some data Local b:Byte [] = [Byte(9), Byte(7), Byte(5), Byte(3), Byte(1)] Udp.send (Varptr b[0], b.length) ' create a loop which waits for some data While True If SocketReadAvail (Udp) ' a bank to store the input Local tmpBank:TBank = CreateBank (1024) ' size of data-package Local length:Int = Udp.recv (BankBuf (tmpBank), tmpBank.size() ) ' print data For Local i:Int = 0 To length - 1 Print tmpBank.PeekByte(i) Next ' exit this loop Exit End If Wend CloseSocket (Udp) EndPS the while/wend exits when data is available..
Ghislain
MacIntel 10.5 - BlitzMax v1.28