Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^6: Sharing sockets between the main script and thread

by markseger (Beadle)
on Nov 30, 2008 at 16:01 UTC ( #726914=note: print w/replies, xml ) Need Help??

in reply to Re^5: Sharing sockets between the main script and thread
in thread Sharing sockets between the main script and thread

Clearly the code you posted is more economic and I suspect it will grow as more error handling is added. For example it looks like it opens a socket and keeps writing to it until the socket closes and that's not the behavior I'm looking for. Rather I want my worker thread to manage open/closing the socket while the mainline does the I/O to it. If multiple sockets are opened, the mainline will write the same strings to all of them, dealing with each connections independently closing/reconnecting. The main line should not care how many (if any) connections are active.

That's probably not all that obvious from looking at the code itself.


  • Comment on Re^6: Sharing sockets between the main script and thread

Replies are listed 'Best First'.
Re^7: Sharing sockets between the main script and thread
by BrowserUk (Pope) on Nov 30, 2008 at 16:09 UTC

    All of which is completely irrelevant as I'm only referring to the mechanism of transferring handles from one thread to another. Still, I've noticed that there is a propensity for some people to prefer complicated to simple.

    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.
      re complexity - no disagreement and I'm always looking for easier ways to do things. I really like the mechanism for sharing file handles via the file number and it does indeed work like a champ for me. The only challenge I had was to take the traditional socket model which tends to have worker threads doing the I/O and turn it on its head because I need a different model, at least I think I do.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://726914]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2018-05-27 16:18 GMT
Find Nodes?
    Voting Booth?