d0n Posted July 14, 2009 Posted July 14, 2009 This code doesn't work when i put TCPListen, but it works when i use TCPConnect. I am trying to listen to this ip/port for incoming messages, not sure what i am missing. $ip = "75.150.216.162" $port = 4099 TCPStartup() $socket = TCPListen($ip, $port) While 1 $recv = TCPRecv ($socket, 5000 ) If $recv <> "" Then MsgBox ( 4096, "recv", $recv ) WEnd
Authenticity Posted July 14, 2009 Posted July 14, 2009 So it's the server code. Have a look in the help file for the example of TCPAccept() function.
d0n Posted July 14, 2009 Author Posted July 14, 2009 (edited) I tried adding a TCPAccept function but TCPListen still wont return anything, however TCPConnect will $ip = "75.150.216.162" $port = "4099" TCPStartup() $socket = TCPListen($ip, $port) While 1 $Accepted = TCPAccept($socket) $recv = TCPRecv ($Accepted, 5000 ) If $recv <> "" Then MsgBox ( 4096, "recv", $recv ) WEnd Edited July 14, 2009 by d0n
Authenticity Posted July 14, 2009 Posted July 14, 2009 What is this IP address? it's yours? or you're trying to listen to another IP address ports, not yours? Again, read the functions description in the help file. Check the return value of a function and write correct code.
CodyBarrett Posted July 14, 2009 Posted July 14, 2009 learning TCP is the hard part... after that most times its a breeze $ip = @IpAddress1 ;"75.150.216.162" try that instead $port = "4099" TCPStartup() $socket = TCPListen($ip, $port, 100);the 100 is the connections (your using the default... maybe thats it While 1 $Accepted = TCPAccept($socket) if $Accepted <> -1 then $recv = TCPRecv ($Accepted, 5000 ) If $recv <> "" Then MsgBox ( 4096, "recv", $recv ) endif sleep (100) WEnd func onautoitexit () TCPclosesocket ($Accepted) TCPshutdown () endfunc i dunno try that out [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now