views:

163

answers:

3

Hi all, I'm trying to send large files using UDP Adobe air to CPP. While transferring large files some packets are missing. How can I retrieve the missing packets data? I'm first of all connecting client(air) with server(cpp) using tcp. After connection establishment I'm starting file transfer. I am planning to get the file missing data using tcp and then resending the missing packets using tcp. Can anybody tell me how can i come to know which packets are missing while transferring. Thank you.

+1  A: 

Can you please clarify what is happening? You say you are sending files over UDP yet connecting to the sever with TCP - the two protocols are mutually exclusive over a single connection.

UDP does not provide any mechanism for detecting packet loss (that's what TCP is for) so by default you won't be able to work out whether packets have been lost. You should use TCP for sending files as it manages sending/resending packets for you.

As stated in the Air ServerSocket documentation (http://help.adobe.com/en_US/air/reference/html/flash/net/ServerSocket.html):

All packets [sent over TCP] are guaranteed to arrive (within reason) — any lost packets are retransmitted. In general, the TCP protocol manages the available network bandwidth better than the UDP protocol. Most AIR applications that require socket communications should use the ServerSocket and Socket classes [TCP] rather than the DatagramSocket class [UDP].

See this page for more information on the Air networking classes:
http://help.adobe.com/en_US/air/html/dev/WSb2ba3b1aad8a27b0-181c51321220efd9d1c-8000.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7cfb

Sly_cardinal
This. UDP is for things like streaming video, where you don't want to resend dropped packets.
fenomas
Hi Sly Cardinal, thanks for your response. Sorry, my question was not clear. My client end is air app and server is of cpp. I'm connecting client to server using tcp and after getting acknowledgement whether that is connected...I'm connecting again using UDP and transferring files using UDP. Now at the time of large files I'm losing packets at server side. Now I just want to get the list of missning packets and want to ask client to resend those missing packets using tcp. Then my air app resends the missing packets using UDP.
Naveen kumar
In short, for connection acknowledgement and packet missing data, I want to use tcp and for file transfer using UDP. Everything is going well..except packet loss. Now I want to know the missing packet list and resend...how can I get the data of missing packets.
Naveen kumar
Thanks for the clarification. However, my advice/answer is still the same. TCP provides the exact functionality you require, ensuring packets are received properly - UDP is the wrong tool for this job. Is there a particular reason that you have chosen UDP over TCP for the file transfer?
Sly_cardinal
A: 

Hi Sly Cardinal,thanks for your response.I found file transfer using TCP is poor in transfer rate. Thats why I'm doing in using UDP. I think, it is some what difficult but nt impossible. Actually I started it with the concept of UFTP. I was looking about packet header concept.Now I got below links and I'm trying to follow as they discussed. I hope these links help me out.

http://www.codeguru.com/forum/archive/index.php/t-449854.html

ht tp://www.codeguru.com/forum/showthread.php?t=306399

ht tp://www.gamedev.net/community/forums/topic.asp?topic_id=470929

If anybody know much more information about the packet header sending and receiving please share. Thank you.

Naveen kumar Pavuturi
A: 

my guess, tcp is slower because it does a resend when a packet gets lost. so that's probably why it's slower. but on the other hand, checking which packets get lost and re-send them by udp will also take longer ...

i would go for TCP instead of UDP

Like Sly says, udp seems the wrong tool to use here

Frank