All pastes #207551 Raw Edit

Trucs

public text v1 · immutable
#207551 ·published 2006-10-18 02:10 UTC
rendered paste body
Hello and thanks for read me.

I have wrote a daemon in ansi C and I use 2 time the recv() function to read from the socket.
Test with telnet work nicely :)
Test with a little php client failed in 99,50%.
Test with the same php client and a sleep(1) between the 2 write on the socket work (but it's slow lol ;)

With ethereal I see that in each case tcp packet are in the same format (and data finish with 0x0d 0x0a).

In working case
first recv(sock,......) return the first value
second recv(sock,......) return the second value

In other case (too fast)
first recv(sock,......) return the first and the second value (concat)
second recv(sock,......) return nothing, client has close the socket

socket parameters : protocole tcp, sock_stream

An idea ?