Jump to content

winsock udp


Recommended Posts

When using this script below the _TCP_DataArrival gets triggered every time but the GetData($data) never returns the data that is being recv'ed

as a server i used

nc -lup 5500 (linux)
and i wrote the data by hand ^_^

any ideea why this is happening?

btw: not sure if it is related but i got the same behavior with the adodb.execute : $obj.execute("query text" , byref $rowsaffected) and $rowsaffected was never changed... (is it possible it's a bug?)

Global $_Socket = ObjCreate("MSWINSOCK.WINSOCK")
ObjEvent($_Socket,"_TCP_")
$_Socket.Protocol=0x01;udp
$_Socket.RemoteHost="192.168.0.2"
$_Socket.RemotePort="5500"
$_Socket.SendData("test")
;$_Socket.Bind(5500,@IPAddress1)
$timer=TimerInit()
Global $data
While TimerDiff($timer)<10000
;   $_Socket.GetData($data)
;   If $data<>"" Then MsgBox(0 , "" , $data)
    Sleep(1)
WEnd
Func _TCP_DataArrival($bytes)
    Local $data,$host
    $_Socket.GetData($data)
    $_Socket.RemoteHost($host)
    MsgBox(0 , $host , "|"&$data&"|",1)
EndFunc 
Func _TCP_Error($Number,$Descr,$Scode,$Source,$Helpfile,$HelpContext,$CancelDisplay)
    MsgBox(0 , "" , StringFormat("%s\n%s\n%s\n%s\n%s\n%s\n%s\n",$Number,$Descr,$Scode,$Source,$Helpfile,$HelpContext,$CancelDisplay))
EndFunc
Edited by TheMadman

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...