O well,
I've got something working.
I borrowed some code from another posting:
BlitzMax Forums/BlitzMax Programming/UDP example
Ghislain
I've got something working.
Strict Local socket:TSocket = CreateUDPSocket() If socket = Null Then RuntimeError "Couldn't create UDP socket" ' Listen to the port! BindSocket(socket, 8080) ' This isn't required.. ' ConnectSocket(socket, HostIp("127.0.0.1"), 8080) ' This seems to be always true.. ' If SocketConnected(socket) Then Print "Socket connected." ' Returns 0.0.0.0 : 0 ' Print DottedIP(SocketRemoteIP(socket)) + " : " + SocketRemotePort(socket) Local counter:Int = 0 Local l:Int = 0 While Not KeyDown(key_escape) l = SocketReadAvail(socket) If l counter = counter + 1 Print "Avail: " + l + " bytes." Print "Data: " + sRead(socket) End If If counter > 10 Then Exit Wend CloseSocket(socket) End ' --------------------------------- ' This is borrowed from 'Yan'.. Function sRead:String (socket:TSocket) Local buf:Byte[1024] Local receivedLen = socket.Recv(buf, 1024) Return String.FromBytes(buf, receivedLen) End Function
I borrowed some code from another posting:
BlitzMax Forums/BlitzMax Programming/UDP example
Ghislain