Cs8581 Networks Laboratory
Cs8581 Networks Laboratory
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).
HARDWARE:
SOFTWARE:
Aim:
To write a java program for socket for HTTP for web page upload and download .
Algorithm
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:
Result:
Thus the program for creating sockets for HTTP web page t o download
was implemented.