TCP via UDP...
Hey Guys,
I'm trying to develope my own wrapper using the new .NET UDPclient class, but there are a few things I'm confused about so maybe someone can help me out here
I am attempting to create my own TCP protocol using UDP so that at any time I can switch, on-the-fly, between guaranteed and non-guaranteed packets without having to keep both a UDP and TCP socket open for each client. I know theoretically how TCP works but I'm not quite sure how the most optimized way of programming those concepts would be undertaken.
This is my understanding of how TCP works and how I'd program it:
1.) A packet is sent from the client to the server. It includes a header with an incremented number included. This number is the ID of the packet for both order and guaranteeing delivery.
2.) Once the server recieves a packet it checks the header for its ID. If the ID is one increment higher than the packets ID sent before then it accepts the packet. If the packet is out of order, for example if it is 2 increments higher, then it puts that packet in a buffer to process later. The server then sends a message to the client to resend the packet that was before the one that was just recieved. The client now resends the packet to the server. The server picks up this packet, double checks if it is in the right order and then processes it. The server then takes the packet that was buffered for later processing and processes that one.
This method is basically done over and over.
Now at any time I want to be able to turn on and off this incrementing header. So that I can then have the speed of UDP.
Is this at all possible? Do you forsee any problems in this method? I believe DirectPlay uses this method so I thought I'd try it too.
Suggestions, Comments, anything?
Thanks,
Synth0id
[edited by - Synth0id on December 18, 2002 5:05:54 PM]
There is no point in doing anything at all, you'll die pretty soon anyway.
That may or may not be the absolute fastest way of doing it, but I don''t forsee any problems.
Star Dart - Java Multiplayer Space Combat at http://www.stardart.net/
Do a web search for "sliding window protocol". There''s tons of info out there.
-Mike
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement