Android Question TCP Socket Timeout

aaronk

Well-Known Member
Licensed User
Hi,

Just wondering when making a connection to a TCP socket, what does the TimeOut do?

Lets say I set the timeout to 5000.

B4X:
Socket1.Initialize("Socket1")
    Socket1.Connect("192.168.0.5" , 1234, 5000)
Does that mean it will try and connect and if it fails to connect in 5 seconds it will timeout and fail to login or does it mean that if no data is sent for longer then 5 seconds it will close the connection ?


upload_2015-2-7_13-51-33.png
 

aaronk

Well-Known Member
Licensed User
So does this mean if I make connection to the device and it fails to connect it will timeout after the time I set or, if I send a command and it takes longer then the timeout time to get through it will then disconnect ?
 

Erel

Administrator
Staff member
Licensed User
This value only affects the connection process. There could be all kinds of connection errors. In some cases the connection will fail immediately. However there are other cases when the connection can be very slow (or even never end). The purpose of the timeout is to prevent very slow connections. Once connected this value has no effect.
 
Top