Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

As pg points out once you have sent the data you should be able to close the socket. Closing a socket should not lead to the loss of lingering (aka buffered send) data. As he also points out if you don't close your sockets you may use up all the available file descriptors on your system. They will not time out for at least several hours. On Win32 you will only have ~512 by default. On *nix you should have ~1024 so it is quite easy to use them all if you don't close sockets in a process.

Are you using Socket or IO::Socket::INET? Can you show a short test case? You may find benefit setting the TCP_NODELAY flag to bypass Nagle's algorithm. I found this reference to SO_LINGER on the Socket FAQ

Closing a socket: if SO_LINGER has not been called on a socket, then close() is not supposed to discard data. This is true on SVR4.2 (and, apparently, on all non-SVR4 systems) but apparently not on SVR4; the use of either shutdown() or SO_LINGER seems to be required to guarantee delivery of all data.

NB SVR4 systems include Solaris 2.x, SCO ODT 3.0, AIX, A/UX.

Although I agree with pg that it should not happen why not try calling shutdown on the socket before you close it or specifically setting the TCP_NODELAY and SO_LINGER options. You might also try syswrite to send your data, instead of send. This bypasses both the send interface and stdio.

cheers

tachyon


In reply to Re: connect() & close() by tachyon
in thread connect() & close() by monktim

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-03-29 02:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found