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