|
From: | Frédéric BERNON |
Subject: | RE : RE : [lwip-users] Sending UDP |
Date: | Tue, 11 Sep 2007 15:49:45 +0200 |
-----Message d'origine-----
De : address@hidden [mailto:address@hidden De la part de Frédéric BERNON
Envoyé : mardi 11 septembre 2007 15:47
À : Mailing list for lwIP users
Objet : RE : [lwip-users] Sending UDPI suppose that udp_send call pbuf_header, this last call change newBuf->payload value, but don't restore it (I don't know if this is an expected behavior).Check that by a display of newBuf->payload before and after udp_send. It should change by -(8(udp_hdr)+14(eth_hdr)).====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : address@hiddenr
Web Site : http://www.hymatom.fr
====================================P Avant d'imprimer, penser à l'environnement-----Message d'origine-----
De : address@hidden [mailto:address@hidden De la part de Julian Gardner [RSD]
Envoyé : mardi 11 septembre 2007 15:37
À : address@hidden
Objet : [lwip-users] Sending UDPI am sending data via UDP, but for every block of data i send which is 1324 bytes i do the following
while( bytesToSend)
{
newBuf = pbuf_alloc( PBUF_TRANSPORT, 1324, PBUF_RAM);
memcpy( newBuf->payload, currentBufferPointer, 1324);
udp_send( outUdp, newBuf);
pbuf_free( newBuf);
currentBufferPointer += 1324;
bytesToSend -= 1324;
}
if i do the allocate outside of the send loop and the delete after sending all , my code fails!
newBuf = pbuf_alloc( PBUF_TRANSPORT, 1324, PBUF_RAM);
while( bytesToSend)
{
memcpy( newBuf->payload, currentBufferPointer, 1324);
udp_send( outUdp, newBuf);
currentBufferPointer += 1324;
bytesToSend -= 1324;
}
pbuf_free( newBuf);
Also i have to copy the data from its original place to the newBuf->payload every time
What is the best way, pbuf_chain to do the same but just point the newBuf->payload at the data without copying it!!
eg
newBuf = pbuf_alloc( PBUF_TRANSPORT, 1324, PBUF_RAM);
while( bytesToSend)
{
newBuf->payload = currentBufferPointer;
udp_send( outUdp, newBuf);
currentBufferPointer += 1324;
bytesToSend -= 1324;
}
pbuf_free( newBuf);
joolz
Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf
[Prev in Thread] | Current Thread | [Next in Thread] |