On Dec 1, 2003, at 1:27 PM, James Edward Gray II wrote:
On Dec 1, 2003, at 2:36 PM, drieux wrote:
[..]
personally I LOVE andrew gaffney's tighter solution
which I would of course modify minutely to:

        while($bytes = sysread(SOCK,$buf,$buf_len)) {
                $data .= $buf;
        }

There is of course the issues with making sure that
is signal safe, that you get yada...

In my admittedly limited experience with network programming,
I've never seen anything like this half-way approach pay off.
[..]

The tragedy is that I mostly agree you, hence why
my whine about creating application layer hand-shake stuff.
Again, the problem with choosing between
        
        a. header/payload
        b. non-line oriented protocol with EOM things

only really becomes interesting if and when you need
to get out of the simplistic 'line oriented' protocol
where one merely grots for the "\n" token.

The classic 'boner' we all pull is getting ourselves
'locked' on a socket waiting for more data, and then
having to get poppped out of it with the socket close.

But these are also the things that folks have to start
somewheres and step out in faith.... and then scream,
and then rewrite and...

remember in the dark they are all just fd's, whether one is doing
pipe, or socket, or grotting through files. it all gets
back down to the boring bits

        open()
        read()
        write()
        close()
        # for everything else,
        # there's ioctl()

{ the devil made me do that... }

[..]
The moral:  Network programming CAN be tricky.
Take it step by step and keep it as simple
as possible for what you need.

The problem there is 'how big is that network', is it really something that is going to have to go out through all them routers, et al, out there in the Big Internet, or merely locally, on an intra-net, or... or... or...

All on one ethernet switch, no hops or hubs...

[..]
we should probably steer the discussion over to forking... ;)

well if you stick a fork() in it, you can see if it's done...

ciao
drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to