|
From: | Ben Bobbitt |
Subject: | [lwip-users] parameter for netif_add in UDP |
Date: | Wed, 13 Feb 2008 13:11:03 -0600 |
Just curious if I’ve missed something in the
documentation, but my application only needs to use UDP, so what
parameter do I pass to the netif_add() function for the input() callback when
setting up the interface? While there is a udp_input() function, its return type(void)
is incompatible with the function prototype for the netif_add() call,
whereas the tcp_input() is consistent ( an err_t return type) … so do I
just use the tcp_input() function as the parameter in that call? I’m wondering if this is why I can’t get the
netconn_recv() to work properly. I can send data using netconn_send(),
but the recv call doesn’t seem to be working. I’ve used
netcat to send UDP data to the system but the receive call doesn’t seem
to be getting it. I used a network sniffer to verify the data on the
line. Any advice would be appreciated. I am
using the atmel avr32 and the IAR compiler. This is under FreeRTOS
with the 1.2.0 version of lwIP. Heres a code snippet from my app pxUDPConnection = netconn_new(NETCONN_UDP); //set ip addr of target addr.addr = htonl(0xc0a80065); // temp 192.168.0.101 netconn_connect(pxUDPConnection,&addr,UDP_DEFAULT_PORT); netconn_bind(pxUDPConnection, NULL,
(u16_t)UDP_DEFAULT_PORT ); pxTxBuffer = netbuf_new(); netbuf_ref(pxTxBuffer,&text[0],sizeof(text)); err= netconn_send(pxUDPConnection,pxTxBuffer); vTaskDelayUntil( &xLastFocusTime, xDelayLength ); /* Loop forever */ for( ;; ) {
while((pxRxBuffer=netconn_recv(pxUDPConnection)) != NULL) {
recv_addr = netbuf_fromaddr(pxRxBuffer);
netbuf_data(pxRxBuffer,&data,&len); //do
something with the data }
netconn_close(pxUDPConnection);
netconn_delete(pxUDPConnection); } No virus found in this outgoing message. |
[Prev in Thread] | Current Thread | [Next in Thread] |