Solved

What's that? SoLinger?

Posted on 1998-07-23
4
3,084 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
Comment Utility
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
Comment Utility
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
Comment Utility
- 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
Comment Utility
Thank.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

762 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

6 Experts available now in Live!

Get 1:1 Help Now