Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

What's that? SoLinger?

Posted on 1998-07-23
4
Medium Priority
?
3,631 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
fontaine earned 120 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

688 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