lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] UDP send ok but Can't find in Ethereal


From: the_gadfly
Subject: [lwip-users] UDP send ok but Can't find in Ethereal
Date: Mon, 29 Jun 2009 19:46:50 -0700 (PDT)

hi:
this is my code,modified form stand-alone lwip example web server. I am
trying to send messages through UDP. But all it is sending are ARP's.

Could anyone tell me what's wrong?

Best Regards
the_gadfly
--------------------------------------------
#define IPADDR0 10  
#define IPADDR1 1
#define IPADDR2 1
#define IPADDR3 51

#define NETMASK0 255
#define NETMASK1 255
#define NETMASK2 255
#define NETMASK3 0

#define GWADDR0 10
#define GWADDR1 1
#define GWADDR2 1
#define GWADDR3 2


int main(void)
{
//0.6.4 struct netif *netif;
struct netif netif;
struct ip_addr ipaddr, netmask, gw;
struct ip_addr udpDestIpAddr; //IP-address to send UDP packet to
struct pbuf* packetBuffer; //Pointer to a packet buffer
struct udp_pcb* udpSocket; //Create UDP-socket
err_t err;
char buffer[]="hello world !";
int i=0;

alt_avalon_lan91c111_if* dev_list_ptr =
(alt_avalon_lan91c111_if*)alt_ethernet_device_list.next;

printf("UDP-server using Light-weight IP (LWIP)\n\n");


packetBuffer = pbuf_alloc(PBUF_TRANSPORT,512,PBUF_RAM);

 packetBuffer -> payload = (void *)buffer;

/*
* Initialize lwip
*/
lwip_init();

printf ("Setting IP address to: %d.%d.%d.%d\n", IPADDR0, IPADDR1, IPADDR2,
IPADDR3);
printf ("Setting netmask to: %d.%d.%d.%d\n", NETMASK0, NETMASK1, NETMASK2,
NETMASK3);
printf ("Setting gateway address to: %d.%d.%d.%d\n\n\n", GWADDR0, GWADDR1,
GWADDR2, GWADDR3);
IP4_ADDR(&ipaddr, IPADDR0, IPADDR1, IPADDR2, IPADDR3);
IP4_ADDR(&netmask, NETMASK0, NETMASK1, NETMASK2, NETMASK3);
IP4_ADDR(&gw, GWADDR0, GWADDR1, GWADDR2, GWADDR3);

//0.6.4 netif = netif_add(&ipaddr, &netmask, &gw,
netif_add(&netif, &ipaddr, &netmask,
&gw,(void*)dev_list_ptr,lan91c111if_init, ip_input);
//0.6.4 netif_set_default(&netif);
netif_set_default(&netif);

IP4_ADDR(&udpDestIpAddr, 10,1,1,52);

udpSocket = udp_new(); 
udp_bind(udpSocket, IP_ADDR_ANY, 30); //Bind socket to port
udp_connect(udpSocket, &udpDestIpAddr, 30); //Bind socket to any incoming
IP-address


printf("Ready to send....\n");

while(i++ < 2)
{


lan91c111if_service(&netif);

err=udp_send(udpSocket, packetBuffer);
if(err==ERR_OK)
printf("send ok !  \n");





} 

//pbuf_free(packetBuffer);
//udp_remove(udpSocket);


}
-----------------------------------------------------------
-- 
View this message in context: 
http://www.nabble.com/UDP-send-ok-but-Can%27t-find-in-Ethereal-tp24263401p24263401.html
Sent from the lwip-users mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]