Solved

What's that? SoLinger?

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

Suggested Solutions

Title # Comments Views Activity
login jsp example 24 85
Java: The Public Class Main 4 45
Eclipse with various Java releases 7 47
netbeans can not run self signed app 8 11
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

756 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