Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Answer: Can I read a line from a socket without the socket sending \n?

by merlyn (Sage)
on Nov 30, 2000 at 21:09 UTC ( #44174=categorized answer: print w/replies, xml ) Need Help??

Q&A > network programming > Can I read a line from a socket without the socket sending \n? - Answer contributed by merlyn

The hardest part about sockets is knowing when to stop reading. You can invent a line-oriented protocol, or use some other indication (like a byte count followed by that many bytes).

Knowing what to use is an art call, decided by experience and study of the prior art. Good luck in your quest!

  • Comment on Answer: Can I read a line from a socket without the socket sending \n?
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[Discipulus]: yes sorry forget and forgive me
[Eily]: for what it's worth I didn't go for the brightest solution either
[Eily]: I tried print eval '2+1/3*(2+2/5))' or print $@
[Eily]: and therefore concluded that the eval did succeed because there was no printed error :P
[Eily]: stupid operator precedence :D

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-10-24 10:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (287 votes). Check out past polls.

    Notices?