metis Posted December 9, 2011 Share Posted December 9, 2011 how to set timeout Code $sHost = "host.pl" TCPStartup() $sName_To_IP = TCPNameToIP($sHost) $iSocket = TCPConnect($sName_To_IP, 80) If $iSocket = -1 Then TCPCloseSocket($iSocket) Exit EndIf $sCommand = "POST / HTTP/1.1" & @CRLF $sCommand &= "User-Agent: Opera/9.80 (Windows NT 5.1; U; pl) Presto/2.9.168 Version/11.51" & @CRLF $sCommand &= "Host: " & $sHost & @CRLF $sCommand &= "Content-Type: application/x-www-form-urlencoded" & @CRLF $sCommand &= "Content-Length: 666" & @CRLF $sCommand &= @CRLF $sCommand &= "XXXXXXXXX" & @CRLF $sCommand &= @CRLF Local $BytesSent = TCPSend($iSocket, $sCommand) If $BytesSent = 0 Then Exit Local $sRecv = "", $sCurrentRecv While 1 $sCurrentRecv = TCPRecv($iSocket, 16) If @error <> 0 Then ExitLoop If $sCurrentRecv <> "" Then $sRecv &= $sCurrentRecv WEnd MsgBox(0, "Read ", $sRecv) TCPCloseSocket($iSocket) TCPShutdown() Link to comment Share on other sites More sharing options...
Zedna Posted December 15, 2011 Share Posted December 15, 2011 (edited) Defines the time before TCP functions stop if no communication. Time in milliseconds before timeout (default=100). Opt('TCPTimeout', 100) Edited December 15, 2011 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
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