Jump to content

Recommended Posts

If the connection doesn't end when the host stops sending data there is no definite way to know if the hosts idles or the connection is slow.

The best way seem to use a timeout, something like this:

Local $timer = TimerInit()
While 1
    Local $recv = TCPRecv($ConnectedSocket, 524288, 1)
    If @error Then ExitLoop
    If $recv <> "" Then
        FileWrite($file, $recv)
        $timer = TimerInit()
    Else If TimerDiff($timer) >= 300 Then; timeout if no has arrived in 300 ms
        ExitLoop
    EndIf
WEnd

Broken link? PM me and I'll send you the file!

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