Reliable Data Transfer

Gamingphreek

Lifer
Mar 31, 2003
11,679
0
81
I'm trying to code a Transport layer on top of my unreliable transfer client/server pair so I can implement congestion control and reliable data transfer for my networking class (*Thus no actual code please*).

I know I can code it with relative ease, but what I am having trouble with is how to structure this code.

This is my psuedo code

Code:
Main Class
   Instantiate new application layer FTP class

FTP Class
   Constructor
      Copy host, port, filename to variables global to the FTP class
   application method
      Open file, connect to socket, open various file streams
      call transport layer
      close all streams and sockets
   transport layer method
      instantiate UDP class
      loop infinitely
           implement cases for congestion control and reliable transfer
           implement case for calling the UDP transfer
UDP class extends TimerTask
   constructor
      copy local variables for I/O streams
   run
      transfer packet in byte stream with header

Am I on the right course here? I don't understand how I send multiple packets in my receive window though? Do I simply instantiate 4 timertask objects? I question it because I feel like the RWIN should be adjustable...

Thanks,
-Kevin
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Standard FTP is single-threaded per download, and uses a reliable transport method. If you wanted to follow that model you'd add a layer in between FTP and UDP.

FTP -> ReliableXfer -> UDP

If you're not trying to match that, you're free to go multithreaded / multiprocess in the FTP logic by creating and managing a pool of UDP objects each working on different parts of the file being transferred.

In either case it's best to make the pool size adjustable instead of a fixed value like 4.
 

Gamingphreek

Lifer
Mar 31, 2003
11,679
0
81
Standard FTP is single-threaded per download, and uses a reliable transport method. If you wanted to follow that model you'd add a layer in between FTP and UDP.

FTP -> ReliableXfer -> UDP

If you're not trying to match that, you're free to go multithreaded / multiprocess in the FTP logic by creating and managing a pool of UDP objects each working on different parts of the file being transferred.

In either case it's best to make the pool size adjustable instead of a fixed value like 4.

Ok - I just checked with my TA and the approach of spawning a new thread for each packet in the Receive Window is what they are looking for.

Would I be correct in saying that I need to create a thread pool of some sort? In my infinite loop for the transfer, I need to create a number of threads equal to the receive window (But this may need to decrease dynamically given that congestion control could take effect)

I'm writing this in Java and I think using the ScheduledThreadPoolExecutor class in conjunction with the Runnable class is what I am looking for. Is this the most efficient way - or am I missing another method in the javadoc.

Thanks,
-Kevin