The code for running the client.
The code for running the server.
Arguments for the client.
Arguments for the server.
Utilities that common for server and client. Includes: create packet, parse packet, checksum, and other useful functions.
Defines some constant values.
Follows the format of the project description - tcpserver file listening_port address_for_acks port_for_acks
.
There are
file
: The file path for writing the data.listening_port
: The port server is running on.address_for_acks
: The address for sending the ACKs.port_for_acks
: The port for sending the ACKs.
There are also --
to assign them.)
-
max_seq_no
: Maximum sequence number. Default is$2^{32} -1$ . -
max_data_size
: Maximum data size for a segment. Default is$20$ (bytes). -
window_size
: Window size. Default is$100$ .
Example:
Run the server on port 41194
, and send the ACKs to localhost:41191
. The maximum data size is
python tcp_server.py output.txt 41194 localhost 41191 --max_data_size 99 --max_seq_no 150 --window_size 100
Follows the format of the project description - tcpclient file address_of_udpl port_number_of_udpl windowsize ack_port_number
.
There are
file
: The file path for reading the data.address_of_udpl
: The address of the newudpl service for sending packets to.port_number_of_udpl
: The port of the newudpl service for sending packets to.windowsize
: Window size.ack_port_number
: The client port for receiving the ACKs.
There are also --
to assign them.)
-
max_seq_no
: Maximum sequence number. Default is$2^{32} -1$ . -
max_data_size
: Maximum data size for a segment. Default is$20$ (bytes).
Example:
Run the client on port 41191
, and send packets to localhost:41192
. The maximum data size is
python tcp_client.py hello.txt localhost 41192 100 41191 --max_data_size 99 --max_seq_no 150
* Important: The windowsize
argument of the client should be equal to the window_size
argument of the server, and the max_seq_no
and the max_data_size
of both server and client should be equal.
- Any window size that is bigger than the data size is available.
- This project take shortage of the sequence number into account that avoid the error when the sequence number exceeds the limit. It will be wrapped around.
- The program can deal with any maximum data size of a segment.
- Dynamic timeout. If timeout happens frequently at the client, it will increase the timeout time. Otherwise, it will shrink the timeout time to
$1$ second.
https://docs.google.com/document/d/1oG2rBz54yhtGVNEhUAMgZOvo9UWjqFu3P2p47E1sanA/edit