lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwip and udp client


From: Sathya Thammanur
Subject: Re: [lwip-users] lwip and udp client
Date: Wed, 4 Oct 2006 07:18:51 -0700

Haori,
In you xilnet code, you are missing the connect function that will connect to the server before the client can send/receive any data. It is better to use lwIP as it is a more stable stack.

Sathya


On 10/3/06, Haori Yang <address@hidden> wrote:
Hi, guys
 
   after struggling with xilnet for a few weeks, I decided to give lwip a try. I think I was so close to make this udp design work, however I need some help.

   can  you give me a rough draft of how udp client work with lwip? what do I need to setup? can I use raw API?

  if you know some about xilnet. could you take a look at my code? I can't figure out what's wrong. plus, I am using AVnet Virtex4 LX evaluation board + microBlaze. the program stops while it enter xilsock_sendto.

  Thanks.

Haori



******************************************************************************
  xilnet_eth_init_hw_addr("00:60:08:11:27:7b");

xilnet_eth_init_hw_addr_tbl();
         
xilnet_ip_init("1.2.3.4");
                
xilnet_mac_init(XPAR_ETHERNET_MAC_BASEADDR);
                 
XEmac_mSetMacAddress(XPAR_ETHERNET_MAC_BASEADDR, mb_hw_addr);
                
XEmac_mEnable(XPAR_ETHERNET_MAC_BASEADDR);

s = xilsock_socket(AF_INET, SOCK_DGRAM, 0);
  

if (s == -1)
  {
        return XST_FAILURE;
  }
 
 
/* Clear out server struct */
memset((void *)&addr, '\0', sizeof(struct sockaddr_in)); 
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = (unsigned int)0x00000000;
addr.sin_port = 8080;

err = xilsock_bind(s, (struct sockaddr *)&addr, sizeof(struct sockaddr));

if (err == -1)
  {
        return XST_FAILURE;
  }

memset((void *)&remote, '\0', sizeof(struct sockaddr_in)); 
remote.sin_family = AF_INET;
remote.sin_addr.s_addr = (unsigned int)0x01020309;
remote.sin_port = 8080;

unsigned int size;
size = (unsigned int)sizeof(struct sockaddr);

for(;;)
{  

xilsock_sendto(s, (unsigned char*)TxFrame, 20,(struct sockaddr *)&remote, size);

}

_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users



reply via email to

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