Android Question TCP Socket Timeout

Discussion in 'Android Questions' started by aaronk, Feb 7, 2015.

  1. aaronk

    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.

    Code:
    Socket1.Initialize("Socket1")
        Socket1.Connect(
    "192.168.0.5" , 12345000)
    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
     
  2. giga

    giga Well-Known Member Licensed User

    I believe it says how long the application is prepared to wait for all of the packet-level timeouts, retransmissions, etc to succeed
     
  3. aaronk

    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 ?
     
  4. Erel

    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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice