[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] Installed the new version, since allthechangesand turne
From: |
Joolz [RSD] |
Subject: |
RE: [lwip-users] Installed the new version, since allthechangesand turned on the ASSERT debug |
Date: |
Tue, 20 Mar 2007 15:45:30 -0000 |
-----Original Message-----
From: Kieran Mansley [mailto:address@hidden
Sent: 20 March 2007 15:08
To: Mailing list for lwIP users
Subject: RE: [lwip-users] Installed the new version, since
allthechangesand turned on the ASSERT debug
On Tue, 2007-03-20 at 14:42 +0000, Joolz [RSD] wrote:
>
> ...
> struct pbuf *data;
> struct pbuf *aaaa;
>
> data = pbuf_alloc( PBUF_RAW, 0, PBUF_RAM);
> aaaa = pbuf_alloc( PBUF_RAW, PAYLOAD_SIZE, PBUF_ROM);
> aaaa->payload = pvMalloc( PAYLOAD_SIZE);
> pbuf_chain( data, aaaa);
> outUdp = udp_new();
> outAddr.addr = htonl( e2Prom.channelSettings.ipAddress);
> udp_bind( outUdp, IP_ADDR_ANY, e2Prom.ethernetSettings.port);
> udp_connect( outUdp, &outAddr, e2Prom.channelSettings.port);
> udp_send( outUdp, data);
>
> Does not work, different error in pbuf.c line 490
>>In short, the first pbuf you've allocated is of zero size, so there's
no room for the headers to go in there. You need to allocate one of
sensible size.
>>Fortunately lwIP will work out this size for you if you specify it as
PBUF_TRANSPORT rather than PBUF_RAW - that's essentially what the first
argument
>>to pbuf alloc is for:
>>
>>eg. data = pbuf_alloc( PBUF_TRANSPORT, 0, PBUF_RAM);
>>
>>This reserves the required space, and you should be able to chain you
other one along at the end. Looking at the lwIP code, I think your
other pbuf should
>>technically be of type PBUF_REF (externally referenced RAM payload)
rather than PBUF_ROM, although there is little difference between them
at the
>>moment.
>>
>>There's a bit of internal lwIP code doing something pretty similar to
this (see tcp_out.c:227) so I'm pretty confident it should work.
>>
>>Kieran
Right tried the code and works on first udp_send but if I then send
another packet I get an assert in pbuf.c 490
..
// Setup linked buffers
data = pbuf_alloc( PBUF_TRANSPORT, 0, PBUF_RAM);
aaaa = pbuf_alloc( PBUF_RAW, PAYLOAD_SIZE, PBUF_REF);
dataBuffer = pvMalloc( PAYLOAD_SIZE);
pbuf_chain( data, aaaa);
// Send 2 buffers
outUdp = udp_new();
outAddr.addr = htonl( e2Prom.channelSettings.ipAddress);
udp_bind( outUdp, IP_ADDR_ANY, e2Prom.ethernetSettings.port);
udp_connect( outUdp, &outAddr, e2Prom.channelSettings.port);
outUdp->flags |= UDP_FLAGS_NOCHKSUM;
outUdp->ttl = 0x38;
data->next->payload = dataBuffer;
udp_send( outUdp, data);
udp_send( outUdp, data);
Do I need to free the data, I thought that would be done by the udp_send
joolz
- RE: [lwip-users] Installed the new version, since allthechangesand turned on the ASSERT debug,
Joolz [RSD] <=