Click here to Skip to main content
15,881,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I should manage a UDP stream with 64 mb/s rate through direct connection using a cross cable. When I receive packets, I see packet lost occurs. I use "winsock" facilities in visual c++ .net 2008. My project type is ATL, the created UDP socket is synchronous and the content of stream is a simple 16 bits counter. Does any body encounter this problem? Pls help me.
Posted
Updated 3-Apr-11 2:35am
v3

UDP doesn't guarantee any reliability, packets may be lost, duplicated or reordered during transmission. If your application can't deal with packet loss, use TCP instead.
 
Share this answer
 
Comments
eh.azimi 4-Apr-11 1:37am    
Thank you for your message. It seems that in a direct connection every thing should be OK and packet lost is not expected.
markkuk 4-Apr-11 5:39am    
Packet loss must always be expected with UDP. See: http://www.29west.com/docs/THPM/packet-loss-myths.html
Albert Holguin 5-Apr-11 10:37am    
markkuk is correct...
Are you accounting for packet headers when calculating the transfer rate? Sending 16 bits in a packet will yield quite a lot of overhead.
 
Share this answer
 
Comments
eh.azimi 4-Apr-11 1:40am    
Transfer rate can be checked using Windows facilities. In 16 bits you can count from 0 to (2 power 16 - 1) in unsigned typed. Then the counter jumps to 0. A separate hardware produces counter and UDP packets. There is no overhead.
Niklas L 4-Apr-11 3:16am    
The minimum UDP packet size for sending a 16 bit value is 80 bits, of which the header is 64 bits. That's quite a lot of overhead.

If the force is with you, you could maybe use the header checksum field to store your data, but that will still require 64 bits to send a 16 bit value.
eh.azimi 4-Apr-11 3:38am    
we fill 1472 bytes of payload in an UDP packet with 736 number of 16 bits. In each 16 bits, a counter is saved. A hardware increases the value of counter and puts new value in the next 16 bits. When 736 number of 16 bits collected together, an UDP packet will be generated. According to this manner, there is no overhead.
Niklas L 4-Apr-11 4:10am    
Ok, well then that won't be a problem.

(I just read "the content of stream is a simple 16 bits counter" meant sending 16 bits in each packet.)
I developp UDP transfer/reception at High Bit rates (12 Mbits/s) without any loss : but without CWinsock Class : try the basic : install winsock but use the WSA functions to tune windows sockets. Also there is a lot of BIOS and IOCTL functions.

After that, if your GUI is correct you will see that it works in real time.

Otherwise you can tune a lot of parameters in the register database : see Microsoft Developer Network (MSDN).

For Higher bit rate I think you should use a User Mode Driver to receive ? (see KMD/UMD framework model).
 
Share this answer
 
Comments
eh.azimi 5-Apr-11 3:31am    
Thank you for your message. May I have that part of your code which establishes UDP connection for high bit rate streams? Where I can find BIOS and IOCTL functions?
Albert Holguin 5-Apr-11 10:36am    
UDP is meant for applications where its ok to lose packets, lets say an audio data stream or a graphics display that updates at a high rate. don't expect not to lose packets in UDP, that's not what it was designed for (hence no error checking).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900