Sign in to follow this  
Followers 0
ArxBzFhblxphS

..

2 posts in this topic

#1 ·  Posted (edited)

Posted Image Edited by Thanubis

Share this post


Link to post
Share on other sites



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!

Share this post


Link to post
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
Sign in to follow this  
Followers 0