Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12748 Discussions

help on development board udp conection setup

Altera_Forum
Honored Contributor II
1,743 Views

hi, all i try to use nios2 development to realize the board and pc udp cimmunication 

 

i modify the demo provided by altera simple socket server, and after iniitialize the network, udp implementation as follows  

 

 

 

struct udp_pcb *pcb; 

struct pbuf* pbuflfsr; 

struct ip_addr udpDestIpAddr,udpLocalIpAddr; 

pbuf_layer layer=PBUF_TRANSPORT; 

pbuf_flag flag=PBUF_RAM; 

u16_t size=1500; 

 

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

IP4_ADDR(&udpLocalIpAddr, 10, 0, 0, 51); 

 

printf("udp_init\n"); 

 

udp_packets = 0; 

 

pcb = udp_new(); 

 

udp_bind(pcb, &udpLocalIpAddr, 30); 

udp_connect(pcb, &udpDestIpAddr,30); 

 

pbuflfsr = pbuf_alloc(layer,size,flag);  

 

for(i=0;i<=size-1;i++) 

((u8_t *)(pbuflfsr->payload)) = 0x11; 

 

while(1) 

udp_sendto(pcb, pbuflfsr, &udpDestIpAddr, 30); 

}  

 

after run in the development, i can see the ethernet port begin to flash, it seems that udp packets have been set 

 

however, in the pc side 10.0.0.52, there is no correct udp packets receieved 

 

please suggest the reason
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
729 Views

please help

0 Kudos
Altera_Forum
Honored Contributor II
729 Views

 

--- Quote Start ---  

originally posted by popeye2004@Apr 27 2006, 09:17 AM 

please help 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14728) 

--- quote end ---  

 

--- Quote End ---  

 

upup
0 Kudos
Altera_Forum
Honored Contributor II
729 Views

popeye, 

 

It looks like you&#39;re trying to use the "raw" API of LWIP, and yet you mention an example (simple socket server) that uses the sockets API. Which do you really want to use? If it&#39;s the "raw" API, then you need to download the stand alone LWIP (provided on this forum) and follow the example(s) that come with it. If it&#39;s the sockets API that you want to use, then you need to change your code to use the sockets API. 

 

Cheers, 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
729 Views

 

--- Quote Start ---  

originally posted by slacker@May 2 2006, 12:40 AM 

popeye, 

 

it looks like you&#39;re trying to use the "raw" api of lwip, and yet you mention an example (simple socket server) that uses the sockets api.  which do you really want to use?  if it&#39;s the "raw" api, then you need to download the stand alone lwip (provided on this forum) and follow the example(s) that come with it.  if it&#39;s the sockets api that you want to use, then you need to change your code to use the sockets api. 

 

cheers, 

 

- slacker 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14904) 

--- quote end ---  

 

--- Quote End ---  

 

 

 

thanks for your reply 

 

i actually dunt mind which api to use 

in fact, what confuse me is about udp server and client relationship 

 

i am trying to work out it and later when i finish, i will post all the code as a referece for those who met same problem
0 Kudos
Reply