Sign in to follow this  
Followers 0
KalInEx

TCPRecv used with option "TCPTimeout" not working as expected!

1 post in this topic

#1 ·  Posted (edited)

Opt("TCPTimeout", 5000)
$KalRET = TCPRecv($Socket, 1000)

It may be my misunderstanding about how the TCPRecv function works but I believe it should wait for upto 5 seconds to recieve some data... what actually happens is that it will recieve data *but* only if its available immediately when called otherwise it simply fails to read anything and waits for 5 seconds even tho at some point in that 5 second timespan there was data to be read.

While TimerDiff($Timer) < 5000
$KalRET = TCPRecv($Socket, 1000)
If $KalRET <> "" Then ExitLoop
WEnd

The above code segment does exactly as I expect... you dont see it here but "TCPTimeout" is set to 0 and the routine polls for data to be read then breaks out of the loop (or gets timed out which ever). Point being it works like I expected the TCPTimeout with a value of 5000 to. I misunderstanding something about the command?

Edited by KalInEx

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