|
-
October 8th, 2004, 02:13 PM
#1
how does a receiver know when sendto() is done?
Hello again.
A little background info:
I have a client server architecture. most of the sending is done from teh server. initially i use tcp to communicate between the client and server to set up some variables (since tcp is reliable). then i use udp to transfer a file (udp because of the type of data i'm sending).. i receive the file on the client side in an infinite while loop:
while (true){
receive
etc.
}
my server also sends in a loop, but not an infinite one. i break the files into chunks the same as the buffer size.
-----------------
The problem:
this is not the greatest way to receive i guess.. i need to know when teh server is done sending.
--------------------------
Options that i considered:
one option is to send a datagram with a closing message (over udp). But this might not be so good because udp is unreliable and the packet might get lost and the client will just keep waiting to receive data. another option is to send an ack from the client. but again, we face the same problem and the server might just keep waiting.
another option i thought of would be to maintain a tcp connection throughout and send a closing message on that.. but i am not allowed to use two ports. this is a restriction that i can't change. i have to use only one port! at the moment , i do my tcp stuff, close the connection and then use the same port for my udp stuff.
would really appreciate any ideas on this and how to figure out if my server is done sending.
thanks,
drew
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|