I don't know how much this will help... It's a fairly common feature of socket implementations that send() over a tcp connection may not write all of the data, which is why it returns the amount of data written. The amount written in one call depends on various network conditions -- if you write to localhost over the loopback interface, you usually don't get partial writes, but it definitely happens if you shove any volume of data exceeding the MSS of the route over a real tcp connection. The Stevens books treat this (Unix Network Programming Vol 2 and TCP Illustrated), and the typical solution is that, when you need to make sure you loop over your sends. Non-blocking sockets just do this more, but blocking sockets will still write less than you requested if you use send(). Send returns when the most recent packet has been written, but you don't know for sure that the other end received it; you have to implement some kind of explicit check for that.
Pete.
