Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^3: Socket Handle not sending data ?

by ikegami (Pope)
on Jul 09, 2009 at 15:28 UTC ( #778604=note: print w/replies, xml ) Need Help??

in reply to Re^2: Socket Handle not sending data ?
in thread Socket Handle not sending data ?

For starters, please use <c>...</c> instead of <pre>...</pre>.

It looks like your object got stringified

$ perl -e' > sub method {} > my $o = bless({}); > $o->method(); # Ok > $o = "$o"; > $o->method(); > ' Can't locate object method "method" via package "main=HASH(0x814ec28)" + (perhaps you forgot to load "main=HASH(0x814ec28)"?) at -e line 6.

Tracing back I see you read a string from a file and expect it to magically become a socket handle. That's not gonna happen.

In fact, the handle gets closed at the end of PortConn as the last reference to it ($rethandle) goes out of scope.

The idea is fundamentally flawed. A handle is a token that represents a resource the OS has handed your process. The token is useless to any other process. If you want to store something, you need to store the connection details so you can re-establish the connection.

Replies are listed 'Best First'.
Re^4: Socket Handle not sending data ?
by evilkamikaze (Initiate) on Jul 09, 2009 at 19:04 UTC
    Hi, Could you please point some good design options? Also, will it work if I try to make it without threads using non-blocking socket call? so if I try to connect to a port and it is not up then instead of blocking I just skip to next port without any delay. Is this something that makes more sense than previous approach? Thanks

      Could you please point some good design options?

      What are you trying yo do?

        I want to send millions of events across multiple servers. And I don't want to stop or block sending if one of the server goes down. I also don't want to skip any event. If the server, that's down, comes backup it should be included into my active servers list to which I am sending all my events. I can't even afford a delay of 0.5 seconds in sending of events. Thanks

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2018-06-25 20:31 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (128 votes). Check out past polls.