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++

Missing UDP packet in NIOS II

Altera_Forum
Honored Contributor II
1,483 Views

I have modified the NIOS II telnet demo, added a UDP socket, and am having trouble with a lost UDP packet. The demo was modified in the following simple manner.  

 

The data transfer TCP socket is used to download configuration data to NIOS II using Winsock 2.2. NIOS then produces a large data set that is transferred in 1024 byte packets via a UDP socket. UDP is used because speed of transfer is of the utmost importance. 

 

Things work great with the exception of loosing a UDP packet. It happens randomly in time once every several hundred to several thousand packets. Using a packet sniffer (CommView) on the PC, I can see that the data transfer TCP port is sending a short 60 byte packet back to the PC at a random spot in the UDP transmission stream. This happens on each UDP burst transmission - successful or not. 

 

But, every time a UDP packet is missing, I can see that instead of a single TCP packet, 2 of these identical TCP packets are being transmitted consecutively. The packet sniffer then shows that a UDP packet is missing. I am not sure if these TCP packets are interferring with the UDP transmission, or they are just a symptom of the lost packet.  

 

I am not an experienced TCP/IP programmer, so maybe there is something obvious here.  

 

Are the send buffers for these two sockets independent pieces of memory or are they the same memory buffer? 

Should I increase the send buffer sizes via setsockopt() thinking that the second TCP packet clobbers the UDP?  

Are these TCP packets keep-alives, or some other sort of housekeeping with the connect socket on the PC?  

Is there some simple way to "stop" all TCP transmission during the UDP burst? 

 

 

Suggestions for a cure?  

 

Thanks 

 

Dan Grolemund
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
627 Views

I can't comment with regards to the demo, but UDP is not a "guaranteed" protocol like TCP. As far as I know, it's more than likely that any collision on your network could cause this to happen, it's up to your application to handle missing packets - this is the main reason that I've only ever used TCP (apart from UDP broadcast messages).  

 

Adrian
0 Kudos
Altera_Forum
Honored Contributor II
627 Views

I'm afraid adac is quite correct. UDP is not a guaranteed protocol, in fact the packet is not guaranteed even to be transmitted. If you want guaranteed delivery you have should use TCP.

0 Kudos
Altera_Forum
Honored Contributor II
627 Views

Hi dgrolem, 

 

I'm new to Nios (and embedded systems) and I'm looking to implement an application via UDP. I just completed the telnet tutorial and was trying to figure out how to use it (the SSS template) for my application. Basically I’m looking to add a UDP socket and I want to read and write to that socket. I’m using UDP because speed is important and it’s not important if some packets are lost. Data read by the socket would be processed in a logic block on the FPGA (stratix 1s40) and then the result would be spat out, back to the socket for transmission. How did you add a UDP socket?  

 

I would be grateful for any help. 

 

 

 

--- Quote Start ---  

originally posted by dgrolem@May 26 2004, 12:43 PM 

i have modified the nios ii telnet demo, added a udp socket, and am having trouble with a lost udp packet. the demo was modified in the following simple manner.  

 

the data transfer tcp socket is used to download configuration data to nios ii using winsock 2.2. nios then produces a large data set that is transferred in 1024 byte packets via a udp socket. udp is used because speed of transfer is of the utmost importance. 

 

things work great with the exception of loosing a udp packet. it happens randomly in time once every several hundred to several thousand packets. using a packet sniffer (commview) on the pc, i can see that the data transfer tcp port is sending a short 60 byte packet back to the pc at a random spot in the udp transmission stream. this happens on each udp burst transmission - successful or not. 

 

but, every time a udp packet is missing, i can see that instead of a single tcp packet, 2 of these identical tcp packets are being transmitted consecutively. the packet sniffer then shows that a udp packet is missing.  i am not sure if these tcp packets are interferring with the udp transmission, or they are just a symptom of the lost packet.  

 

i am not an experienced tcp/ip programmer, so maybe there is something obvious here.   

 

are the send buffers for these two sockets independent pieces of memory or are they the same memory buffer? 

should i increase the send buffer sizes via setsockopt() thinking that the second tcp packet clobbers the udp?  

are these tcp packets keep-alives, or some other sort of housekeeping with the connect socket on the pc?  

is there some simple way to "stop" all tcp transmission during the udp burst? 

 

 

suggestions for a cure?  

 

thanks 

 

dan grolemund 

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

--- quote end ---  

 

--- Quote End ---  

0 Kudos
Reply