Professional Documents
Culture Documents
Computer Networks
Computer Networks
1. ping: Used to test the reachability of a host on an Internet Protocol (IP) network. It sends ICMP echo
request packets to the target host and waits for an ICMP echo reply.
2. traceroute (or tracert on Windows): Traces the route that packets take to reach a destination host. It
shows the IP addresses of the routers along the path and measures the time it takes for packets to reach
each router.
3. ifconfig (or ipconfig on Windows): Displays the configuration of all network interfaces on the system
including IP addresses, MAC addresses, and network-related statistics.
4. netstat: Displays network connections, routing tables, interface statistics, masquerade connections,
and multicast memberships.
5. nslookup (or dig): Used to query the Domain Name System (DNS) to obtain domain name or IP
address mapping, or other DNS records.
6. route: Displays or modifies the computer's routing table. It shows the IP routing table and allows users
to manipulate routing entries.
7. arp: Displays and modifies the Address Resolution Protocol (ARP) cache, which contains mappings of
IP addresses to MAC addresses.
8. ssh: Stands for Secure Shell. It is used to securely access a remote computer or server over a network.
It provides encrypted communication between the client and the server.
9. scp: Stands for Secure Copy Protocol. It is used to securely copy files between hosts on a network. It
uses SSH for data transfer and provides encryption and authentication.
10. wget (or curl): Used to download files from the web. It retrieves content from web servers using
HTTP, HTTPS, or FTP protocols.
Experiment 2 : WireShark
WireShark Interface
UDP
TCP
TLS
Failure
Experiment 3 : Client Server Architecture
Code:
Server :
import java.io.*;
import java.net.*;
try (
){
String inputLine;
out.println(inputLine);
} catch (IOException e) {
System.out.println("Exception caught when trying to listen on port " + portNumber + " or listening for a
connection");
System.out.println(e.getMessage());
}
Client :
import java.io.*;
import java.net.*;
try (
){
System.out.println("Connected to server");
String userInput;
out.println(userInput);
if (userInput.equals("quit")) {
break;
}
} catch (UnknownHostException e) {
System.exit(1);
} catch (IOException e) {
System.exit(1);
Output:
Experiment 4 : Multithreaded Socket Programming
Code:
Server :
import java.io.*;
import java.net.*;
while (true) {
clientThread.start();
} catch (IOException e) {
System.out.println("Exception caught when trying to listen on port " + portNumber + " or listening for a
connection");
System.out.println(e.getMessage());
}
this.clientSocket = clientSocket;
try (
){
String inputLine;
out.println(inputLine);
} catch (IOException e) {
System.out.println(e.getMessage());
} finally {
try {
clientSocket.close();
} catch (IOException e) {
System.out.println(e.getMessage());
Client :
import java.io.*;
import java.net.*;
try (
){
System.out.println("Connected to server");
String userInput;
if (userInput.equals("quit")) {
break;
} catch (UnknownHostException e) {
System.exit(1);
} catch (IOException e) {
System.exit(1);
Output: