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

Re: How to make EOF?

by cdarke (Prior)
on Mar 04, 2009 at 09:31 UTC ( [id://748056]=note: print w/replies, xml ) Need Help??


in reply to How to make EOF?

You are probably thinking of the EOF returned by some C functions, which is indeed -1, but that is used in a different way. Even socket programs written in C would not use that. Windows uses a Control-Z character as an EOF marker in text files, but that causes all sorts of problems - don't go there.

I always prefix my socket data blocks with a fixed length red-tape block at the front. This can consist of a sanity check (to make sure we know this is the start of a new block), a request code (you might not need, but could also be an error code) and the length of the data block which follows.

Log In?
Username:
Password:

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

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

    No recent polls found