Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Syntactic Confectionery Delight
 
PerlMonks  

Re: Newline Character and Socket Comms

by chorg (Monk)
on May 04, 2001 at 15:40 UTC ( [id://77993]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Newline Character and Socket Comms

You're using the readline operator <> to read your socket. This operator will, of course read _lines_ of input. The default line separator is \n. Your server code will read bytes until it sees a line end, just like it would if you were reading from a file. When you printed the "\n" to the socket, the server thought that the socket reading was over, and continued on. If you want to read bytes over newlines, you'll need to do a

local $/= (anything but\n)

inside your server to make sure that the server thinks that the end of the line is what you say it is whilst it it reading from the socket...
_______________________________________________
"Intelligence is a tool used achieve goals, however goals are not always chosen wisely..."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://77993]
help
Sections?
Information?
Find Nodes?
Leftovers?
    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.