[En-Nut-Discussion] Problems with TCP reception
Eduardo Serantes
eserantes at telefonica.net
Thu Apr 14 11:33:47 CEST 2005
Hi all,
I'm just trying to receive in the Ethernut a 100 kbytes data stream (TCP
connection), and I always have between 5 and 13 bytes changed from the
original file. TCP works ok and there is no error in the reception. I'm
using the native call NutTcpReceive because is binary data. I have tried a
lot of code with the same result. An example:
Data_Add = 0x8000;
Data_Bk = DataBlock;
Aux_Size = DataLen;
buff=malloc(size_buffer); //tested size_buffer=10,20,50,100,800,1000 or 1460
while ( (bite=NutTcpReceive(sock,buff,size_buffer)) > 0) && (Aux_Size > 0)){
for (i=0; i < bite; i++) {
NutSegBufEnable(Data_Bk);
*(u_char *)Data_Add = buff[i];
if (Data_Add == 0xBFFF) {
Data_Add = 0x8000;
if (Data_Bk == 29)
Data_Bk = 0;
else
Data_Bk += 1;
} else
Data_Add += 1;
} // Fin del for
Aux_Size = Aux_Size - bite;
} // Fin del while
I have also tried to allocate the buffer straight to the external RAM in the
NutTcpReceive call, with the same result. Has anybody experienced something
similar?
Thx in advance,
Eduardo
More information about the En-Nut-Discussion
mailing list