prog2 - CSS 432 Program 2 Sliding Window Professor Munehiro...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSS 432 Program 2: Sliding Window Professor: Munehiro Fukuda Due date: See the Syllabus 1. Purpose This assignment implements the sliding window algorithm and evaluates its performance improvement over 100Mbps and 1Gbps networks. You are to observe the performance improvement of 20,000 packet transfers as increasing the size of a sliding window. 2. UDP UDP is a connectionless, unreliable datagram transfer protocol. To implement the sliding window algorithm, we use UDP that brings up some typical network problems we have to address: loss and disorder of packets transferred between a client and a server. While you can send a variable size of data with UDP as far as it is less than 8Kbytes, we sends a packet whose size is fitted to the Ethernet MTU, (i.e., 1500bytes.) Excluding the fragment header, the actual data size we can use for UDP is 1460bytes. This way avoids further fragmentation at the data link layer and thus we can accurately implement the sliding window algorithm using UDP. Since it is not our major concern to explore UDP, use the UdpSocket class which you can find in ~css432/hw2 . Also, you can use Timer class in the same directory for your implementation and performance evaluation. UdpSocket Class Methods Descriptions UdpSocket( int port ) A default constructor that opens a UDP datagram socket with a given port. Use the last five digits of your student ID as the port number. ~UdpSocket( ) A default destructor that closes the UDP datagram socket it has maintained. bool setDestAddress( char ipName[] ) Set the destination IP address corresponding to a given server ipName. This method must be called before sending the first UDP message to the server. int pollRecvFrom( ) Check if this socket has data to read. The method returns the number of bytes to read or 0 if no messages have arrived. In general, a program is blocked to receive data if there are no data to receive. Call this method if you need to prevent your program from being blocked when receiving data. int sendTo( char msg[], int length ) Send msg[] of the length size from a client to a server whose address must be set by setDestAddress( ) a priori. If you send a single char variable, say c , your call should be sendTo( , int sizeof( c ) ) .
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
int recvFrom( char msg[], int length ) Receive data into msg[] of the length size. This method can be both used to receive a message from a client as well as an acknowledgment from a server. If you receive a single char variable, say c , your call should be recvFrom( , int sizeof( c ) ) . ackTo( char msg[], int length ) Send an acknowledgment from a server to a client. Prior to calling this method, a server must receive at least one message from a client, (i.e, call recvFrom( ) at least one time.) Timer Class Methods Descriptions Timer( ) A default constructor that zero-initializes its internal tv_sec and tv_usec variables. start( )
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 5

prog2 - CSS 432 Program 2 Sliding Window Professor Munehiro...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online