Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Newline Character and Socket Comms

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


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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-23 11:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found