Gauge, try making the following modification. Change:
SendUDPMsg stream,"localhost",2000
-to->
SendUDPMsg stream,2130706433,2000
and it'll work :)
The problem was that you were passing the string "localhost" as the integer IP address SendUDPMsg needs to send off it's message (which of course Blitz silently changed to '0' once it realized an integer was needed). If you want to see how you can do name resolution, here are a few functions ripped from my BlitzPlay source which may prove useful:
Function BP_ConvertIp% (IP$)
;-=-=-=Convert an IP from x.x.x.x to integer format.
Local dot1 = Instr(IP$,".")
Local dot2 = Instr(IP$,".",dot1+1)
Local dot3 = Instr(IP$,".",dot2+1)
Local Octet1% = Mid$(IP$,1,dot1-1)
Local Octet2% = Mid$(IP$,dot1+1,dot2-1)
Local Octet3% = Mid$(IP$,dot2+1,dot3-1)
Local Octet4% = Mid$(IP$,dot3+1)
Return (((((Octet1 Shl 8) Or Octet2) Shl 8) Or Octet3) Shl 8) Or Octet4
End Function
Function BP_ConvertDomain% (domain$)
;-=-=-=Converts from www.domain.com to integer IP address.
ips% = CountHostIPs (domain)
If ips Then
Return HostIP(ips)
Else
Return 0
End If
End Function
There ya go. The difference is ConvertIP does the work mathematically, while ConvertDomain uses the networking stack to try to do name resolution for us. Hopefully this helps :) And hey if you want to save time why not take a look at my BlitzPlay library.. it takes the grunt work out of UDP ;) See my sig if you're interested.