I am not using raw api now, but... Check what tcp_write and tcp_output returns, are the err's ERR_OK? For first and second call?
It looks like you can receive only the bytes that fill into sndbuf free space. Than try 2 options, first: 1) check how much space you have in sendbuf (len) 2) take exacly that amount of data and do tcp_write, (change pointer) 3) force send with tcp_output 4) after tcp_output check sendbuff free space again - how much space is there now? If there are no free space - maybie try to hardcode a simple wait/delay and check sendbuf after some time? Alternate option: 1) check how much space you have in sendbuf (len) 2) take exacly that amount of data and do tcp_write 3) force send with tcp_output 4) wait for sent callback 5) got to point 1 but with rest of the data. Dominik 2014-10-03 14:59 GMT+02:00 Nikeah Q <[email protected]>: > Hello, > > I'm having a lot of trouble sending large data using TCP. I read that > multiple tcp_writes will be required so as a simple test, i've tried this > in my tcp accept method: > > int len = tcp_sndbuf(newpcb); > > while(sentSize < 8192) > { > err = tcp_write(newpcb, data, len, 0x01); > err = tcp_output(newpcb); > > sentSize += len; > } // end while > > Data is an array with 4096 elements. len evaluates to 5893. > > My receiving application detects only 5893 bytes sent. This is confirmed > using wireshark. Running the code in the debugger shows that both > tcp_write and tcp_output are called twice. > > Am I missing anything here? > > Thanks in advance, > > Nikeah > > _______________________________________________ > lwip-users mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/lwip-users > -- Pozdrawiam Dominik Wybrańczyk
_______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
