0% found this document useful (0 votes)
1K views12 pages

Stop and Wait vs Sliding Window Protocols

The document describes algorithms for implementing various networking protocols and applications using TCP and UDP sockets in Java, including: 1) Stop and wait and sliding window protocols for reliable data transfer. 2) Socket programming to display date/time between client and server. 3) Simulating ARP and RARP protocols for address resolution. 4) Simulating PING and traceroute commands. 5) Creating an HTTP socket for web page upload/download. 6) Implementing remote procedure calls (RPC). 7) Implementing subnetworking and finding subnet masks. 8) Echo client/server, chat client/server, and file transfer client/server using TCP sockets. 9) DNS client/

Uploaded by

cs0814
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views12 pages

Stop and Wait vs Sliding Window Protocols

The document describes algorithms for implementing various networking protocols and applications using TCP and UDP sockets in Java, including: 1) Stop and wait and sliding window protocols for reliable data transfer. 2) Socket programming to display date/time between client and server. 3) Simulating ARP and RARP protocols for address resolution. 4) Simulating PING and traceroute commands. 5) Creating an HTTP socket for web page upload/download. 6) Implementing remote procedure calls (RPC). 7) Implementing subnetworking and finding subnet masks. 8) Echo client/server, chat client/server, and file transfer client/server using TCP sockets. 9) DNS client/

Uploaded by

cs0814
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
  • Implementation of Stop and Wait Protocol and Sliding Window Protocol
  • Study of Socket Programming and Client – Server model
  • Write a code simulating ARP/RARP protocols
  • Write a code simulating PING and Trace route command
  • Create a socket for HTTP for web page upload and download
  • Write a program to implement RPC (Remote Procedure Call)
  • Implementation of Subnetting
  • Applications using TCP Sockets like Echo client and Echo server
  • Applications using TCP Sockets like TCP File Server/Client
  • Applications using TCP and UDP Sockets like DNS and SNMP
  • Applications using TCP and UDP Sockets like File Transfer

EX.

NO:1

DATE:
Implementation of Stop and Wait Protocol and Sliding Window Protocol
AIM:
To write a java program to perform data transfer operation using Stop and Wait Protocol and
Sliding Window Protocol.
ALGORITHM:

STOP AND WAIT PROTOCOL:

[Link] the program.


[Link] connection with receiver.
[Link] create the frame based on the user request.
[Link] send data from sender to receiver side.
[Link] your frames reach the receiver it will send ACK signal to sender otherwise it will send
NACK
signal to sender.
[Link] stop and wait protocol, sender send group of messages to the receiver, receiver stop and wait
receive one by one and send the ACK to sender.
[Link] the program

SLIDING WINDOW PROTOCOL:

[Link] the program.


[Link] connection with receiver. otherwise sender waiting for a connection.
[Link] the connection was done connection established message displayed.
[Link] will send data and waiting for an ACK.
[Link] send message will be received by receiver frame by frame.
[Link] sliding window protocol, sender send message to the receiver, If your frames reach the
receiver it will send ACK signal to sender for each and every frame of message otherwise it will
send NACK signal to sender.
[Link] the program

Result:

Thus the implementation of stop and wait protocol and sliding window protocol was executed
successfully.
[Link] Study of Socket Programming and Client – Server model

AIM:
To implement socket programming date and time display from client to server using TCP Sockets
ALGORITHM:
Server
1. Create a server socket and bind it to port.
2. Listen for new connection and when a connection arrives, accept it.
3. Send server’s date and time to the client.
4. Read client’s IP address sent by the client.
5. Display the client details.
6. Repeat steps 2-5 until the server is terminated.
7. Close all streams.
8. Close the server socket.
9. Stop.
Client
1. Create a client socket and connect it to the server‟s port number.
2. Retrieve its own IP address using built-in function.
3. Send its address to the server.
4. Display the date & time sent by the server.
5. Close the input and output streams.
6. Close the client socket.
7. Stop.

Result:

Thus the implementation of socket programming date and time display from client to server using
TCP Sockets was executed successfully.
[Link] Write a code simulating ARP/RARP protocols.

Aim:

To write a java program for simulating ARP protocols using TCP and RARP protocols using UDP

ALGORITHM:

Address Resolution Protocol:

Client

1. Start the program

2. Using socket connection is established between client and server.

3. Get the IP address to be converted into MAC address.

4. Send this IP address to server.

5. Server returns the MAC address to client.

Server

1. Start the program

2. Accept the socket which is created by the client.

3. Server maintains the table in which IP and corresponding MAC addresses are stored.

4. Read the IP address which is send by the client.

5. Map the IP address with its MAC address and return the MAC address to client.
ALGORITHM:

Reverse Address Resolution Protocol (RARP)

Client

[Link] the program

2. using datagram sockets UDP function is established.

[Link] the MAC address to be converted into IP address.

[Link] this MAC address to server.

[Link] returns the IP address to client.

Server

1. Start the program.

2. Server maintains the table in which IP and corresponding MAC addresses are stored.

3. Read the MAC address which is send by the client.

4. Map the IP address with its MAC address and return the IP address to client.

Result:

Thus the implementation of simulating ARP protocols using TCP and RARP protocols using UDP was
executed successfully.
EX-NO. 4

Write a code simulating PING and Trace route command

Aim:

To Write the java program for simulating ping command and Trace route command.

Algorithm

Step 1: start the program.

Step 2: Include necessary package in java.

Step 3: To create a process object p to implement the ping command and Trace route command.

Step 4: declare one Buffered Reader stream class object.

Step 5: Get the details of the server using ping command.

5.1: length of the IP address.

5.2: time required to get the details.

5.3: send packets , receive packets and lost packets.

5.4: minimum ,maximum and average times.

Step 6: Get the details of the server using Trace route command.

6.1:IP address and length of IP address

Step 7: print the results.

Step 8:Stop the program.

Result:

Thus the implementation of simulating ping command and Trace route command was executed
successfully.
[Link] 5. Create a socket for HTTP for web page upload and download.
Aim:
To write a java program for socket for HTTP for web page upload and download .
Algorithm
[Link] the program.
[Link] the file from preferred domain.
[Link] create HTTP webpage upload to particular domain name.
[Link] the program the downloaded HTTP web page would appear on file location side.
[Link] downloaded HTTP page contain new location moved request of a document.
[Link] the program

Result:

Thus the Creation of socket an HTTP for web page upload and download was executed successfully.
EX-NO 6. Write a program to implement RPC(Remote Procedure Call)
Aim:
To write a java program to implement RPC (remote procedure call)
Algorithm :
Step 1: start the program.
Step 2: include the necessary packages in java.
Step 3: create an interface as ucet and extends the predefined interface remote into it.
Step 4: declare the remote methods inside the interface used.
Step 5: declare the class rpc and extends the predefined class.
Step 6: unicast remote object an implement the interface ucet into it.
Step 7: declare the class server &create an object ob for the class rpc.
Step 8: declare the class client
Step 9: call the remote methods using the object ob which is the object of the
interfaceucet.
Step 10: the remote method contains the methods such as
Functions of calculator.
Step 11:Stop the program.

Result:

Thus the implementation of RPC(Remote Procedure Call) method was executed


successfully.
EX-NO 7. Implementation of Sub netting
Aim:
Write a program to implement sub netting and find the subnet masks.
Algorithm :

[Link] the program.

[Link] the IP address and Split the string that displayed in binary form

[Link] the number of addresses and calculation of mask that number of bits required for address.

[Link] the subnet masks and Calculate first and last addresses.

[Link] the program.

Result:

Thus the Implementation of Sub netting program was executed successfully.


EX-NO 8a.
Applications usingTCP Sockets like
Echo client and Echo server
Aim
To implement echo server and client in java using TCP sockets.
Algorithm
Server
1. Create a server socket.
2. Wait for client to be connected.
3. Read text from the client
4. Echo the text back to the client.
5. Repeat steps 4-5 until ‘bye’ or ‘null’ is read.
6. Close the I/O streams
7. Close the server socket
8. Stop
Client
1. Create a socket and establish connection with the server
2. Get input from user.
3. If equal to bye or null, then go to step 7.
4. Send text to the server.
5. Display the text echoed by the server
6. Repeat steps 2-4
7. Close the I/O streams
8. Close the client socket
9. Stop
Result
Thus data from client to server is echoed back to the client to check reliability/noise level of
the channel.

[Link]:8b

Applications using TCP Sockets like


TCP Chat Server/Client
Aim
To implement a chat server and client in java using TCP sockets.
Algorithm
Server
1. Create a server socket
2. Wait for client to be connected.
3. Read Client's message and display it
4. Get a message from user and send it to client
5. Repeat steps 3-4 until the client sends "end"
6. Close all streams
7. Close the server and client socket
8. Stop
Client
1. Create a client socket and establish connection with the server
2. Get a message from user and send it to server
3. Read server's response and display it
4. Repeat steps 2-3 until chat is terminated with "end" message
5. Close all input/output streams
6. Close the client socket
7. Stop
Result
Thus both the client and server exchange data using TCP socket programming.

[Link]:8c

Applications using TCP Sockets like


TCP File Server/Client
Aim
To implement a file server and client in java using TCP sockets.
Algorithm
Server
1. Create a server socket
2. Wait for client to be connected.
3. Read filename from client
4. Open the file using java File methods
5. Write file contents onto stream until EOF
6. Close all streams
7. Close the server and client socket
8. Stop
Client
1. Create a client socket and establish connection with the server
2. Get filename from user and send it to server
3. Read file contents from server stream and display it
4. Close all input/output streams
5. Close the client socket
6. Stop
Result
Thus file contents was sent from server to client using TCP socket programming
[Link]:9a
Applications using TCP and UDP Sockets like
a)DNS
Aim
To implement a DNS server and client in java using UDP sockets.
Algorithm
Server
1. Define a array of hosts and its corresponding IP address in another array
2. Create a datagram socket
3. Create a datagram packet to receive client request
4. Read the domain name from client to be resolved
5. Lookup the host array for the domain name
6. If found then retrieve corresponding address
7. Construct a datagram packet to send response back to the client
8. Repeat steps 3-7 to resolve further requests from clients
9. Close the server socket
10. Stop
Client
1. Create a datagram socket
2. Get domain name from user
3. Construct a datagram packet to send domain name to the server
4. Create a datagram packet to receive server message
5. If it contains IP address then display it, else display "Domain does not exist"
6. Close the client socket
7. Stop

Result
Thus domain name requests by the client are resolved into their respective logical
address using lookup method.

[Link]:9b

Applications using TCP and UDP Sockets like


b)SNMP

Aim
To implement SNMP server in java using UDP sockets.
Algorithm
Server
1. Create a datagram socket
2. Receive client's message in a datagram packet.
3. Read Client's message and display it
4. Convert text from client to upper case and send it back to client
5. Repeat steps 2-4 until the client has something to send
6. Close the server socket
7. Stop
Client
1. Create a datagram socket
2. Get a message from user
3. Construct a datagram packet and send it to server
4. Create a datagram packet to receive echoed message
5. Read server's response and display it
6. Repeat steps 2-5 until there is some text to send
7. Close the client socket
8. Stop

Result
Thus data from client to server is check reliability of the channel information was executed.
[Link]:9c

Applications using TCP and UDP Sockets like


c)File Transfer

Aim
To implement a file server and client in java using UDP sockets.
Algorithm
Server
1. Create a server socket
2. Wait for client to be connected.
3. Read filename from client
4. Open the file using java File methods
5. Write file contents onto stream until EOF
6. Close all streams
7. Close the server and client socket
8. Stop
Client
1. Create a client socket and establish connection with the server
2. Get filename from user and send it to server
3. Read file contents from server stream and display it
4. Close all input/output streams
5. Close the client socket
6. Stop
Result
Thus file contents was sent from server to client using UDP socket programming.

EX.NO:1  
 
DATE:  
Implementation of Stop and Wait Protocol and Sliding Window Protocol 
AIM: 
To write a java program
EX.NO:2 Study of Socket Programming and Client – Server model  
AIM:  
To implement socket programming date and time disp
EX.NO:3 Write a code simulating ARP/RARP protocols. 
Aim:  
To write a java program for simulating ARP protocols using TC
ALGORITHM:  
Reverse Address Resolution Protocol (RARP) 
Client  
1.Start the program  
2. using datagram sockets UDP funct
EX-NO. 4    
Write a code simulating PING and  Trace route command 
Aim:  
To Write the java program for simulating ping co
EX.NO 5. Create a socket for HTTP for web page upload and download. 
Aim: 
To write a java program for socket for HTTP for we
EX-NO 6. Write a program to implement RPC(Remote Procedure Call) 
Aim: 
To write a java program to implement RPC (remote proc
EX-NO 7.                              Implementation of Sub netting 
Aim: 
Write a program to implement sub netting and fin
EX-NO 8a.  
Applications usingTCP Sockets like 
 Echo client and Echo server 
Aim 
To implement echo server and client in
5. Repeat steps 3-4 until the client sends "end" 
6. Close all streams 
7. Close the server and client socket 
8. Stop 
Clien

You might also like