Link to home
Start Free TrialLog in
Avatar of threshold
threshold

asked on

What's that? SoLinger?

What's the difference between SoLinger and SoTimeout in java.net.Socket/java.net.ServerSocket ?
ASKER CERTIFIED SOLUTION
Avatar of fontaine
fontaine

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of threshold
threshold

ASKER

Thank you for this answer. I see the document of JDK 1.1.x , the setSoLinger(...) is defined as
    Socket.setSoLinger(boolean enable,int val)
If I set the enable as False and close the socket, will it close the connection immediately or wait for data transmittion forever?

And, I know the setSoTimeout in ServerSocket will effect the block-time of accept().
Could you tell me what the setSoLinger in ServerSocket will effect?
- Set to false: no linger timeout -> the connection will be closed only when the data transmitted
to the socket has been successfully delivered (as TCP guarentees this). In general, a linger timeout should not be used. If you use it, there is the possibility to have packets of this connection interfering with packets of a new connection in the case where it is established from the same client socket port to the same server port.

- There is no setSoLinger() method for a ServerSocket in JDK 1.1. Is there?

Thank.