Of course if the incoming netbuf/pbuf says it only holds 10 bytes there
is no point in changing its length: it doesn't have more. I suggest
tracing what's on the wire using wireshark/ethereal and comparing that
with what you receive. Breakpoints in the ethernet driver also help a lot.
Simon
Francois Bouchard wrote:
Ok, but the incoming netbuf says it's 10 bytes. I tried your suggestion to
change length from 10B to 20B (as u8_t to u16_t) but it does not help; I
dont receive the good data.
if(netbuf_data(inbuf, (void*)&buf, &buflen) == ERR_OK)
{
netconn_write(conn, buf, buflen, NETCONN_NOCOPY);
}
This code works for a string ie. it sends exactly the same thing. But for
ushorts I can't manage them. Maybe I'll stick to strings ... and change the
client test program.
Thanks
Francois
----- Original Message -----
From: <[email protected]>
To: "Mailing list for lwIP users" <[email protected]>
Sent: Monday, February 16, 2009 12:22 PM
Subject: Re: [lwip-users] netbuf_data() netconnwrite() problem
Francois Bouchard wrote:
Ok, I think that the cast is the good thing to do (I got exemple that
does that).
But that does'nt fix my problem. The client application sends 10
unsigned short, then the server is supposed to send back the 10 u16_t
var, but it retransmits half of the data. The length of the pBuf is
10; but is it 10 octets? If so that is why I get half of my data back.
Hope it's not confusing
It is, a little. But with the pbuf length you are right: both p->len and
p->tot_len are byte counters. When sending 10 ushorts, you have to set
the size of data to send to the correct amount.
E.g. when sending an array: tcp_write(.., (void*)ushort_array,
10*sizeof(ushort), ...)
or when executing 10 individual writes: tcp_write(.., (void*)an_ushort,
sizeof(ushort), ...)
Simon
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users