[mw-devel] CVS Update at silver.sucs.org: marvin
arthur at sucs.org
Mon Mar 8 13:54:48 GMT 2004
> As far as I can see, that's really the purpose of the C for statement,
> i.e. so you can do for any linear structure the equivalent of 'for
> (i=0;i<n;i++)'. I don't see why this is a problem where the loop length is
> variable as long as your code is sane.
There isnt a problem, its just personal taste.
> Obviously ugliness is a matter of opinion. Personally I'd rather have the
> convenience of continue than have to use goto or do everything manually
> every time.
a straw poll seems to be split about 50/50 on the issue
> > > * What is the purpose of 'int net' in client.c ? It seems redundant
> OK, why not use it in the server too?
The client only handles 2 file handles, and is code reused from somewhere
else that just happened to name them, but the server is a rewrite and
uses an arbitrary number (a linked list) of them.
> > > Possible bugs:
> > > * Sometimes it seems the server doesn't actually receive any data
> > > - e.g. size=0 expect=5 . In fact it seems only to receive the first
> > > message intact. But the quit command always works, so apaprently it
> > > really does receive it.
> > Your not guaranteed to receive anything intact, thats why theres all
> > that buffering and chopping up stuff in session.
> The weird thing is that the server apparently receives the data and yet
> 'size' is always 0 except for the first message.
If you follow the logic around, you see that the size value thats
printed is how much data is left over in the buffer from the previous
read, and that value is printed (debug called) before its read the
new data into the buffer.
therefore, if its 0 then that means all of the data from the previous
read was parsed and used. This should be pretty much the norm.
More information about the mw-devel