Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20744 Discussions

problems receiving UDP packets

Altera_Forum
Honored Contributor II
1,675 Views

I have developped an application that is running in the host to send and receive UDP packets to my Cyclone III evaluation NIOSII board. 

 

The transmision of the packets from my FPGA board are working but I don't have received yet any data from host. 

 

The project running in FPGA is based on the NIOSII example called simple sockets server  

 

 

void SSSSimpleSocketServerTask() { 

struct sockaddr_in serverAddr;  

int udpsock, status=0, bytes_sent=0, Init_img=0, Data_Length_Packet=0; 

alt_u8 buf[MAX_UDP_LENGHT], id_packet=0;  

alt_u8 *data_pointer = buf; 

alt_u8 *img_pointer = img_buffer; 

 

int fromlen;  

 

//----------- configuracion del socket --------------  

serverAddr.sin_family = AF_INET; 

serverAddr.sin_port = htons (SSS_PORT); 

serverAddr.sin_addr.s_addr = INADDR_ANY; 

 

fromlen = sizeof (serverAddr); 

if ((udpsock = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { // protocol <IPPROTO_UDP> 

alt_NetworkErrorHandler(EXPANDED_DIAGNOSIS_CODE,"[sss_task] Socket creation failed"); 

 

//----------- inicio del sistema --------------  

IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, 0xff);  

data_pointer += 4; //apunta al campo de datos del buffer a transmitir 

img_pointer = img_buffer; //posicion inicial de imagen 

 

//----------------------------------------------  

//------------- bucle principal --------------- 

//---------------------------------------------- 

 

while(1){ 

 

printf("listening to UDP port...\n");  

status = recvfrom(udpsock, buf, 10, 0,(struct sockaddr*)&serverAddr, &fromlen);  

if (status == -1){ 

alt_NetworkErrorHandler(EXPANDED_DIAGNOSIS_CODE,"[sss_task] Rx UDP error");  

id_packet = 0; 

bytes_sent = 0; 

}  

 

 

 

After recvfrom() this application is always locked waiting incoming packets although I have sent some packets from the host computer.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
577 Views

Hello There, 

have u got solution for your problem... 

i am stuck in similera type of problem... 

 

my UDP server is running on RHEL-4 machine sending 7 UDP packet of 1000 byte . 

my client running of NIOS-ii ( Cyclone) expecting these 7 packet's but it receive only 1464 char only ( 1st packet + 464 char of second packet). 

please help me out why this happening. 

 

kaushal
0 Kudos
Altera_Forum
Honored Contributor II
577 Views

You've said that a lot already, in several threads. We gave you some answers and suggestions. did you do anything about it?

0 Kudos
Reply