Cs8581 Networks Laboratory

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

CS8581 NETWORKS LABORATORY

LIST OF EXPERIMENTS

1. Learn to use commands like tcpdump, netstat, ifconfig, nslookup and traceroute.
Capture ping and traceroute PDUs using a network protocol analyzer and examine.
2. Write a HTTP web client program to download a web page using TCP sockets.
3. Applications using TCP sockets like:
a) Echo client and echo server
b) Chat
c) File Transfer
4. Simulation of DNS using UDP sockets.
5. Write a code simulating ARP /RARP protocols.
6. Study of Network simulator (NS) and Simulation of Congestion Control Algorithms
using NS.
7. Study of TCP/UDP performance using Simulation tool.
8. Simulation of Distance Vector/ Link State Routing algorithm.
9. Performance evaluation of Routing protocols using Simulation tool.
10. Simulation of error correction code (like CRC).

LIST OF EQUIPMENT FOR A BATCH OF 30 STUDENTS:

LABORATORY REQUIREMENT FOR BATCH OF 30 STUDENTS:

HARDWARE:

1. Standalone desktops 30 Nos

SOFTWARE:

1. C / C++ / Java / Python / Equivalent Compiler 30


2. Network simulator like NS2/Glomosim/OPNET/ Packet Tracer / Equivalent
EX.NO 2. Write a HTTP web client program to download a web page using TCP
sockets.

Aim:
To write a java program for socket for HTTP for web page upload and download .

Algorithm

1.Start the program.


2.Get the frame size from the user
3.To create the frame based on the user request.
4.To send frames to server from the client side.
5.If your frames reach the server it will send ACK signal to client otherwise it
will send NACK signal to client.
6.Stop the program

Program :
import java.io.*;
import java.net.*;
public class SocketHTTPClient
{
public static void main(String[] args)
{
String hostName = "www.sunnetwork.in";
int portNumber = 80;
try
{
Socket socket = new Socket(hostName, portNumber);
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
BufferedReader in =new BufferedReader(new
InputStreamReader(socket.getInputStream()));
out.println("GET / HTTP/1.1\nHost: www.sunnetwork.in\n\n");
String inputLine;
while ((inputLine = in.readLine()) != null)
{
System.out.println(inputLine);
}
}
catch (UnknownHostException e)
{
System.err.println("Don't know about host " + hostName);
System.exit(1);
}
catch (IOException e)
{
System.err.println("Couldn't get I/O for the connection to " + hostName);
System.exit(1);
}
}
}
Output:

Viva questions:

1. What is HTTP and WWW?


2. To which OSI layer does IP belong?
3. What HTTP response headers do?
4. What is HTTP session state?
5. What is Secure HTTP?
6. What is the current version of HTML?
7. What is HTTP session and what is session id?
8. What is the main usage of session id?
9. Define cookie and list some real time examples where the cookies are used.

Result:
Thus the program for creating sockets for HTTP web page t o download
was implemented.

You might also like