Solved

What's that? SoLinger?

Posted on 1998-07-23
4
3,373 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 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

Technology Partners: 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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

739 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