Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: recv() on forked process

by BrowserUk (Pope)
on Jul 26, 2012 at 20:20 UTC ( #983928=note: print w/ replies, xml ) Need Help??


in reply to recv() on forked process

as soon as the child attempts to recv() from the server to check for messages - the parent stops and the tcp connection appears broken.

You cannot send from a socket whilst it is blocked in a recv.

That is, you cannot both send to & recv from (one end of) a socket simultaneously.

You can simulate something like it, by setting the socket non-blocking; and polling the socket (select) to determine if there is anything to be read; and only attempting a recv if there is; thus keeping the time spent in the recv state to a minimum and maximising the time when a send will complete successfully.

But this comes at the expense of forcing your application into operating like a party line. Something most monks will be too young to remember. Heck. I only vaguely remember the concept.

But then again, things have a habit of going full circle. For a while there -- roughly the '80s to mid '90s -- companies had these amazingly magical devices called "answer phones" (for the younger amongst you, think "voice mail").

If you called them, and they were out or too busy to take the call, you left them your name and telephone number; and they called you back. Simples.

Now -- for "our convenience and satisfaction" the inanimate voice lies -- we have to poll the damn phone listening to that awful tiny, usually out-of-date, and always cheesy musac interminably, all the time hoping that same inanimate voice won't come back and lie to us again:

  • "Your call is important to us";
  • "One of our Customer Relations Enhancement Executive Professionals will be with you momentarily";
  • "We are currently experiencing an unprecedented volume of calls; it might take a tad longer than normal to take your call";
  • "While we've got you tied to listening to us; have you considered purchasing more of the service you are calling to complain about? Here we will layout in excruciating detail, the bewildering set of pricing plans that all come with our we-will-not-be-beaten price guarantee and of course; our award winning service.".

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?


Comment on Re: recv() on forked process
Re^2: recv() on forked process
by zentara (Archbishop) on Jul 27, 2012 at 13:17 UTC
    the party line .... Something most monks will be too young to remember

    Now it's something you tow, or an 800 number. :-)


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (12)
As of 2014-07-11 18:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (234 votes), past polls