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

Re^4: Socket Listener

by sans-clue (Beadle)
on Mar 31, 2010 at 21:38 UTC ( [id://832158]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Socket Listener
in thread Socket Listener

If anyone is still watching, this seems to get me started. I couldn't get the POE to work for me.
use IO::Socket; my $sock = new IO::Socket::INET ( LocalHost => 'nonsvch', LocalPort => '6543', Proto => 'tcp', Listen => 1, Reuse => 1, ); die "Could not create socket: $!\n" unless $sock; my $new_sock = $sock->accept(); while(<$new_sock>) { print $_; } close($sock);
It works ok if I telnet to it, type and hit return, but my feed has no CRLF, it does however have end of record strings
=*=
so how do I make it read without blocking for CRLF ? Thanks

Replies are listed 'Best First'.
Re^5: Socket Listener
by BrowserUk (Patriarch) on Mar 31, 2010 at 21:49 UTC

    Try using recv instead of the diamond operator.

    Update: Or setting $/ = '=*=';


    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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2025-12-15 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (95 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.