Hi,Thanks for looking through my problem but I managed to find the cause.
Actually, it's a rather stupid mistakes but I was so sure about the rightness
of all the other functionsthat I didn't see it. In the server_received
function, when I create a struct connection_state* cs, I forgot to equalize cs
and arg (cs=arg).So, what was passed to processCommand and then sent was
something totally unexpected.I had done it and checked it in every other
function except this one !Anyway, I was just wondering, now it's sending all of
my data, good start. On my client side, when I start sending such data which
will be written into a file, there must bea too long time between the two sets
of data send to the client so it believes than it is another file and create a
new file and writes over the former one.Well, there is definitely something to
fix on my client and I only see that solution, just like I can give to the
client the size of the file to be sent and tell him to only write a file until
that much data has been received. But I was wondering also if there was
something that I haven't done to solve this solution on the server side:void
send_data(struct tcp_pcb *pcb, struct connection_state *cs){ u16_t len; err_t
err; /* We cannot send more data than space available in the send buffer.*/
if(tcp_sndbuf(pcb) < (cs->left)) { len = tcp_sndbuf(pcb); } /*
Otherwise, the length is equal to the size of the data to be sent */ else {
len = cs->left; } err = tcp_write(pcb, cs->data, len, 1); /*
Queue the data to be sent, if tcp_write does not send back ERR_OK, force the
data transfer. */ if(ERR_OK==err) { cs->data += len; cs->left -=
len; } else if(err==ERR_MEM) { tcp_output(pcb); } /* If the data to be
send is smaller than the send buffer size, then force the data transfer to
speed it up. */ if(cs->left == 0) { tcp_output(pcb); } } Thanks a lot
for your help once again,Louis.
_________________________________________________________________
Besoin d'un e-mail ? Créez gratuitement un compte Windows Live Hotmail, plus
sûr, plus simple et plus complet !
http://www.windowslive.fr/hotmail/default.asp_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users