Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: socket reading...

by traveler (Parson)
on Jul 28, 2001 at 01:45 UTC ( [id://100465]=note: print w/replies, xml ) Need Help??


in reply to socket reading...

If the TCP server is keeping the connection open (that is, not doing a C close(2) on the socket) and if the server does not set the PSH (push) bit on the TCP segments containing the newlines, the last portion of data may not make it to your application for some time.

If you control the application server, you can likely control the first aspect: closing the socket. You may or may not be able to cause the PSH bit to be set.

As wog noted, sysread returns 0 (the number of bytes read) on EOF, but it is only EOF iff the socket is closed by the server.

--traveler

Replies are listed 'Best First'.
Re: Re: socket reading...
by jdv79 (Sexton) on Jul 28, 2001 at 03:50 UTC
    The problem with that is that the TCP server is a relaitvely dumb host and does not have the ability to close the socket. My client has to do that. From what I am hearing and what I have been trying since my initial post is that the best way to exit the recieve stream read would be to match on the prompt even though I cant see it from the client. This presents a slight issue.
      You could try to send some sort of a NOP (e.g. just an empty request or newline equivalent). That might force the server to send out some more data (e.g. prompts) causing your client host to flush the buffer to the application. Enough NOP packets might get you a prompt to your app. You'd have to skip empty prompts on the next read if they are not all delivered to your application.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://100465]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-26 04:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found