Solved

What's that? SoLinger?

Posted on 1998-07-23
4
3,165 Views
Last Modified: 2012-08-13
What's the difference between SoLinger and SoTimeout in java.net.Socket/java.net.ServerSocket ?
0
Comment
Question by:threshold
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
fontaine earned 30 total points
ID: 1228107
SoTimeout
----------------

SoTimetout is the amount of time after which a blocking socket operation will automatically
abort.

SoLinger
-------------

TCP guarentees to deliver data transmitted to a socket. This means that when a socket is
closed, the network connection is not immediately terminated but will remain open while all
unsent data is transmitted. SoLinger is the amount of time the OS will wait until closing
the network connection starting from the instant the socket has been closed.

Sources: Java Network Programming ISBN 1-884777-34-1
0
 
LVL 2

Author Comment

by:threshold
ID: 1228108
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?
0
 
LVL 5

Expert Comment

by:fontaine
ID: 1228109
- 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?

0
 
LVL 2

Author Comment

by:threshold
ID: 1228110
Thank.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unexpected HttpURLConnection connection behavior 2 86
recursion example 16 111
thymeleaf natural templating vs JSP 2 67
tomcat not starting 6 30
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now