Jump to content

HTTP Request - Timeout


metis
 Share

Recommended Posts

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

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...