Which code on that page are you trying to use? It appears that most of the code posted is for BlitzMax rather than Blitz3d.
I have implemented similar communication between Bridge Command and the Map Controller. For this, I decided to use UDP rather than TCP for this. TCP guarantees eventual delivery of the packet, and in the right order. This means that each packet may be resent many times, resulting in a significant slow-down. With UDP, you have none of this overhead, so the process is much faster, but there is no guarantee that the packets will come through in the right order (or at all).
I decided that getting some packets through quickly was more important, but you do need to discard any packets that come through in the wrong order.
As an example, here is some simple, bi-directional code.
AppTitle "Sender"
;set up address and ports (note that if the sender and client run on different computers, then only 1 port is required)
ipAddress = dotToInt("127.0.0.1")
udpSendPort = 40002
udpRecvPort = 40001
;make stream
udpStream=CreateUDPStream(udpRecvPort)
UDPTimeouts 30 ;wait 30ms to receive see if any message comes in
i=0
While Not KeyHit(1)
i=i+1
If udpStream <> 0
WriteString udpStream, "Test send " + Str(i)
SendUDPMsg(udpStream, ipAddress, udpSendPort)
;receive too
recvIP = RecvUDPMsg(udpStream)
If recvIP <> 0
Print ReadString(udpStream)
EndIf
Else
Print "No stream created"
EndIf
Wend
CloseUDPStream udpStream
End
Function DotToInt%(ip$)
ip$=Trim$(ip$)
ip1=split$(ip$,1,".")
ip2=split$(ip$,2,".")
ip3=split$(ip$,3,".")
ip4=split$(ip$,4,".")
Return ip1 Shl 24 + ip2 Shl 16 + ip3 Shl 8 + ip4
End Function
Function Split$(in$,n,delim$)
;splits string by one character delimiter
;returns nth component
For i = 1 To n
;find location of next delimiter
;find part to left of delimiter
pos=Instr(in$,delim$)
If pos=0
;no further delimiter found
If i<>n
lh$="" ;there is no nth part of the list, so return ""
Else
lh$=in$ ;we have found the nth part, which is the last in the list
EndIf
Exit ;break out of loop
EndIf
lh$ = Left(in$,pos-1)
;discard part to left of delimiter
in$ = Right(in$,Len(in$)-pos)
Next
Return lh$
End Function
AppTitle "Receiver"
;set up address and ports (note that if the sender and client run on different computers, then only 1 port is required)
ipAddress = dotToInt("127.0.0.1")
udpSendPort = 40001
udpRecvPort = 40002
;make stream
udpStream=CreateUDPStream(udpRecvPort)
UDPTimeouts 30 ;wait 30ms to receive see if any message comes in
i=0
While Not KeyHit(1)
i = i + 1
If udpStream <> 0
recvIP = RecvUDPMsg(udpStream)
If recvIP <> 0
Print ReadString(udpStream)
EndIf
;send a message too
WriteString udpStream, "Test reply " + Str(i)
SendUDPMsg(udpStream, ipAddress, udpSendPort)
Else
Print "No stream created"
EndIf
Wend
CloseUDPStream udpStream
End
Function DotToInt%(ip$)
ip$=Trim$(ip$)
ip1=split$(ip$,1,".")
ip2=split$(ip$,2,".")
ip3=split$(ip$,3,".")
ip4=split$(ip$,4,".")
Return ip1 Shl 24 + ip2 Shl 16 + ip3 Shl 8 + ip4
End Function
Function Split$(in$,n,delim$)
;splits string by one character delimiter
;returns nth component
For i = 1 To n
;find location of next delimiter
;find part to left of delimiter
pos=Instr(in$,delim$)
If pos=0
;no further delimiter found
If i<>n
lh$="" ;there is no nth part of the list, so return ""
Else
lh$=in$ ;we have found the nth part, which is the last in the list
EndIf
Exit ;break out of loop
EndIf
lh$ = Left(in$,pos-1)
;discard part to left of delimiter
in$ = Right(in$,Len(in$)-pos)
Next
Return lh$
End Function