0% found this document useful (0 votes)
17 views25 pages

Computer Networks Lab: UDP & TCP Code

Uploaded by

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

Computer Networks Lab: UDP & TCP Code

Uploaded by

cse23boyz
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CS3591 - COMPUTER NETWORKS LAB (Questions + Full Code)

(Each experiment separated by a heavy line)

============================================================

1) Write Echo client and server using UDP and verify received string.

// [Link]
import [Link].*;
public class EchoServerUDP {
public static void main(String[] a) throws Exception {
int port = 5000;
byte[] buf = new byte[2048];
DatagramSocket s = new DatagramSocket(port);
while (true) {
DatagramPacket p = new DatagramPacket(buf, [Link]);
[Link](p);
[Link](new DatagramPacket([Link](), [Link](), [Link](), [Link]()));
}
}
}

// [Link]
import [Link].*; import [Link];
public class EchoClientUDP {
public static void main(String[] a) throws Exception {
String host = [Link]>0 ? a[0] : "[Link]";
int port = [Link]>1 ? [Link](a[1]) : 5000;
String msg = [Link]>2 ? a[2] : "hello";
byte[] data = [Link](StandardCharsets.UTF_8);
try (DatagramSocket s = new DatagramSocket()) {
[Link](2000);
[Link](new DatagramPacket(data, [Link], [Link](host), port));
byte[] buf = new byte[2048];
DatagramPacket r = new DatagramPacket(buf, [Link]);
[Link](r);
String got = new String([Link](), 0, [Link](), StandardCharsets.UTF_8);
[Link]([Link](got));
}
}
}

============================================================

2) Write a simple client-server application using UDP.

// [Link]
import [Link].*;
public class SimpleServerUDP {
public static void main(String[] a) throws Exception {
int port = [Link]>0? [Link](a[0]) : 5100;
byte[] buf = new byte[1024];
try (DatagramSocket s = new DatagramSocket(port)) {
while (true) {
DatagramPacket p = new DatagramPacket(buf, [Link]);
[Link](p);
String resp = "ACK:" + new String([Link](), 0, [Link]());
byte[] out = [Link]();
[Link](new DatagramPacket(out, [Link], [Link](), [Link]()));
}
}
}
}

// [Link]
import [Link].*; import [Link];
public class SimpleClientUDP {
public static void main(String[] a) throws Exception {
String host = [Link]>0? a[0] : "[Link]";
int port = [Link]>1? [Link](a[1]) : 5100;
byte[] d = "ping".getBytes(StandardCharsets.UTF_8);
try (DatagramSocket s = new DatagramSocket()) {
[Link](2000);
[Link](new DatagramPacket(d, [Link], [Link](host), port));
byte[] buf = new byte[1024];
DatagramPacket r = new DatagramPacket(buf, [Link]);
[Link](r);
[Link](new String([Link](), 0, [Link](), StandardCharsets.UTF_8));
}
}
}

============================================================

3) Write a program to perform File Transfer in Client & Server Using TCP.

// [Link]
import [Link].*; import [Link].*; import [Link].*;
public class FileServerTCP {
public static void main(String[] a) throws Exception {
int port = [Link]>0? [Link](a[0]) : 5200;
Path root = [Link]([Link]>1? a[1] : ".").toAbsolutePath();
try (ServerSocket ss = new ServerSocket(port)) {
while (true) {
Socket c = [Link]();
new Thread(() -> serve(c, root)).start();
}
}
}
static void serve(Socket c, Path root) {
try (c; BufferedReader in = new BufferedReader(new InputStreamReader([Link]()));
DataOutputStream out = new DataOutputStream([Link]())) {
String line = [Link](); // "GET <filename>"
if (line == null || ![Link]("GET ")) { [Link]("ERR"); return; }
String fname = [Link](4).trim();
Path file = [Link](fname).normalize();
if (![Link](root) || ![Link](file) || [Link](file)) { [Link]
byte[] data = [Link](file);
[Link]("OK"); [Link]([Link]); [Link](data);
} catch (Exception ignored) {}
}
}

// [Link]
import [Link].*; import [Link].*; import [Link].*;
public class FileClientTCP {
public static void main(String[] a) throws Exception {
String host = [Link]>0? a[0] : "[Link]";
int port = [Link]>1? [Link](a[1]) : 5200;
String fname = [Link]>2? a[2] : "[Link]";
try (Socket s = new Socket(host, port);
BufferedWriter w = new BufferedWriter(new OutputStreamWriter([Link]()));
DataInputStream in = new DataInputStream([Link]())) {
[Link]("GET " + fname + "\n"); [Link]();
String st = [Link]();
if (!"OK".equals(st)) { [Link]("ERR"); return; }
int n = [Link]();
byte[] data = [Link](n);
[Link]([Link]("download_"+new [Link](fname).get
}
}
}

============================================================

4) Write a simple HTTP web client program using TCP sockets to download a web page.

// [Link]
import [Link].*; import [Link].*;
public class HTTPClient {
public static void main(String[] a) throws Exception {
if ([Link]==0) { [Link]("Usage: java HTTPClient <[Link] return; }
URL u = new URL(a[0]);
String host = [Link]();
int port = ([Link]()==-1)?80:[Link]();
String path = [Link]().isEmpty()?"/":[Link]() + ([Link]()==null? "":"?"+[Link](
try (Socket s = new Socket(host, port);
BufferedWriter w = new BufferedWriter(new OutputStreamWriter([Link]()));
InputStream in = [Link]();
FileOutputStream fos = new FileOutputStream("[Link]")) {
[Link]("GET " + path + " HTTP/1.1\r\nHost: " + host + "\r\nConnection: close\r\n\r\n");
ByteArrayOutputStream all = new ByteArrayOutputStream(); [Link](all);
byte[] b = [Link]();
String headerSep = "\r\n\r\n";
int idx = new String(b).indexOf(headerSep);
[Link](idx>=0? [Link](b, idx+[Link](), [Link]) : b);
}
}
}

============================================================

5) Write the use of tcpdump, netstat, ifconfig/ipconfig, nslookup, traceroute. (Sample outputs)

# tcpdump (Unix) RESULT


13:45:21.324561 IP [Link].443 > [Link].50324: Flags [P.], length 1420
13:45:21.324590 IP [Link].50324 > [Link].443: Flags [.], ack 1421, win 501

# netstat RESULT
Proto Local Address Foreign Address State
TCP [Link]:80 [Link]:0 LISTEN
UDP [Link]:53 *:*

# ifconfig RESULT
eth0: flags=4163<UP,BROADCAST,RUNNING> mtu 1500
inet [Link] netmask [Link] broadcast [Link]

# ipconfig RESULT
IPv4 Address. . . . . . . . . . . : [Link]
Subnet Mask . . . . . . . . . . . : [Link]
Default Gateway . . . . . . . . . : [Link]

# nslookup RESULT
Server: [Link]
Address: [Link]#53
Non-authoritative answer:
Name: [Link]
Address: [Link]

# traceroute (Unix) RESULT


1 [Link] 1.123 ms
2 [Link] 3.204 ms
3 [Link] 25.312 ms
4 [Link] ([Link]) 30.456 ms

============================================================

6) Write a program to implement DNS using UDP sockets.

// [Link]
import [Link].*; import [Link].*; import [Link];
public class DNSServerUDP {
static final Map<String,String> map = new HashMap<>();
static { [Link]("[Link]","[Link]"); [Link]("[Link]","[Link]"); }
public static void main(String[] a) throws Exception {
int port = [Link]>0? [Link](a[0]) : 5300;
byte[] buf = new byte[512];
try (DatagramSocket s = new DatagramSocket(port)) {
while (true) {
DatagramPacket p = new DatagramPacket(buf, [Link]); [Link](p);
String q = new String([Link](),0,[Link](), StandardCharsets.UTF_8).trim().toL
byte[] out = [Link](q, "ERR").getBytes(StandardCharsets.UTF_8);
[Link](new DatagramPacket(out, [Link], [Link](), [Link]()));
}
}
}
}

// [Link]
import [Link].*; import [Link];
public class DNSClientUDP {
public static void main(String[] a) throws Exception {
String host = [Link]>0? a[0]:"[Link]"; int port=[Link]>1? [Link](a[1]) : 530
String domain = [Link]>2? a[2] : "[Link]";
try (DatagramSocket s = new DatagramSocket()) {
[Link](2000);
byte[] q = [Link](StandardCharsets.UTF_8);
[Link](new DatagramPacket(q, [Link], [Link](host), port));
byte[] buf = new byte[256]; DatagramPacket r = new DatagramPacket(buf, [Link]); [Link]
[Link](new String([Link](),0,[Link](), StandardCharsets.UTF_8));
}
}
}

============================================================

7) Write a program to implement ARP protocols.

// [Link]
import [Link].*; import [Link].*; import [Link];
public class ARPServer {
static final Map<String,String> map = new HashMap<>();
static { [Link]("[Link]","aa:bb:cc:dd:ee:01"); [Link]("[Link]","aa:bb:cc:dd:ee:02");
public static void main(String[] a) throws Exception {
int port = [Link]>0? [Link](a[0]) : 5400;
try (DatagramSocket s = new DatagramSocket(port)) {
byte[] buf = new byte[128];
while (true) {
DatagramPacket p = new DatagramPacket(buf, [Link]); [Link](p);
String ip = new String([Link](),0,[Link](), StandardCharsets.UTF_8).trim();
byte[] out = [Link](ip, "NA").getBytes(StandardCharsets.UTF_8);
[Link](new DatagramPacket(out, [Link], [Link](), [Link]()));
}
}
}
}

// [Link]
import [Link].*; import [Link];
public class ARPClient {
public static void main(String[] a) throws Exception {
String host=[Link]>0?a[0]:"[Link]"; int port=[Link]>1?[Link](a[1]):5400; Str
try (DatagramSocket s = new DatagramSocket()) {
[Link](2000);
byte[] q = [Link](StandardCharsets.UTF_8);
[Link](new DatagramPacket(q, [Link], [Link](host), port));
byte[] buf = new byte[128]; DatagramPacket r = new DatagramPacket(buf, [Link]); [Link]
[Link](new String([Link](),0,[Link](), StandardCharsets.UTF_8));
}
}
}

============================================================

8) Write a program to implement CRC algorithm for error detection.

// [Link]
import [Link].CRC32; import [Link];
public class CRC {
public static void main(String[] a){
String msg = [Link]>0? [Link](" ", a) : "hello crc";
CRC32 c = new CRC32(); [Link]([Link](StandardCharsets.UTF_8));
[Link]("0x%08X%n", [Link]());
}
}

============================================================

9) Write a program to implement distance vector routing algorithm and illustrate the path.

// [Link]
import [Link].*;
public class DistanceVectorSim {
static class Node {
final int id; Map<Integer,Integer> neigh = new HashMap<>(); Map<Integer,Integer> dist = new H
Node(int id){ [Link]=id; [Link](id,0); [Link](id,id); }
}
public static void main(String[] a){
int n=4; Node[] nodes = new Node[n]; for(int i=0;i<n;i++) nodes[i]=new Node(i);
link(nodes,0,1,1); link(nodes,1,2,2); link(nodes,2,3,1); link(nodes,0,2,4);
boolean changed=true; int rounds=0;
while(changed && rounds<20){ changed=false; rounds++;
for(Node u: nodes){
for(int v: [Link]()){
Node nb = nodes[v]; int w = [Link](v);
for([Link]<Integer,Integer> e: [Link]()){
int dest=[Link](), d = [Link]();
int cand = w + d;
int cur = [Link](dest, 1_000_000);
if(cand < cur){ [Link](dest,cand); [Link](dest, v); changed=true; }
}
}
}
}
[Link]("Converged in rounds="+rounds);
for(Node u: nodes){
[Link]("From "+[Link]+":");
for(int d=0; d<n; d++){
int cost=[Link](d,999999);
Integer nx=[Link](d);
[Link](" to "+d+" cost="+cost+" next-hop="+(nx==null?"-":nx));
}
}
[Link]("Path 0->3:");
printPath(nodes,0,3);
}
static void link(Node[] ns,int a,int b,int w){ ns[a].[Link](b,w); ns[b].[Link](a,w); }
static void printPath(Node[] ns,int s,int t){
int cur=s; [Link](s);
Set<Integer> seen=new HashSet<>();
while(cur!=t && ![Link](cur)){
[Link](cur);
Integer nx = ns[cur].[Link](t);
if(nx==null){ [Link](" -> unreachable"); return; }
[Link](" -> "+nx); cur=nx;
}
[Link]();
}
}

============================================================

10) Write a socket program for simulation of CHAT server.

// [Link]
import [Link].*; import [Link].*; import [Link].*;
public class ChatServer {
static CopyOnWriteArrayList<PrintWriter> clients = new CopyOnWriteArrayList<>();
public static void main(String[] a) throws Exception {
int port = [Link]>0? [Link](a[0]) : 5500;
try (ServerSocket ss = new ServerSocket(port)) {
while (true) { Socket s = [Link](); new Thread(() -> handle(s)).start(); }
}
}
static void handle(Socket s){
try (s; BufferedReader in=new BufferedReader(new InputStreamReader([Link]()));
PrintWriter out=new PrintWriter([Link](), true)) {
[Link](out);
String line;
while((line=[Link]())!=null){
for (PrintWriter w: clients) [Link](line);
}
} catch(Exception ignored) {}
}
}

// [Link]
import [Link].*; import [Link].*;
public class ChatClient {
public static void main(String[] a) throws Exception {
String host=[Link]>0?a[0]:"[Link]"; int port=[Link]>1?[Link](a[1]):5500;
try (Socket s = new Socket(host, port)) {
Thread t = new Thread(() -> {
try (BufferedReader in = new BufferedReader(new InputStreamReader([Link]())
String line; while ((line=[Link]())!=null) [Link](line);
} catch(Exception ignored){}
});
[Link](true); [Link]();
try (BufferedReader kb = new BufferedReader(new InputStreamReader([Link]));
PrintWriter out = new PrintWriter([Link](), true)) {
String line; while((line=[Link]())!=null) [Link](line);
}
}
}
}
============================================================

11) Write a socket program for simulation of echo server (TCP multi-client).

// [Link]
import [Link].*; import [Link].*;
public class EchoServerTCP {
public static void main(String[] a) throws Exception {
int port=[Link]>0?[Link](a[0]):5700;
try(ServerSocket ss=new ServerSocket(port)){
while(true){ Socket s=[Link](); new Thread(()->serve(s)).start(); }
}
}
static void serve(Socket s){
try(s; BufferedReader in=new BufferedReader(new InputStreamReader([Link]()));
PrintWriter out=new PrintWriter([Link](), true)) {
String line; while((line=[Link]())!=null){ [Link](line); }
} catch(Exception ignored){}
}
}

// [Link]
import [Link].*; import [Link].*;
public class EchoClientTCP {
public static void main(String[] a) throws Exception {
String host=[Link]>0?a[0]:"[Link]"; int port=[Link]>1?[Link](a[1]):5700; Str
try(Socket s=new Socket(host,port); BufferedReader in=new BufferedReader(new InputStreamReade
PrintWriter out=new PrintWriter([Link](), true)) {
[Link](msg); [Link]([Link]());
}
}
}

============================================================

12) Write a code simulating RARP protocols for client and server.

// [Link]
import [Link].*; import [Link].*; import [Link];
public class RARPServer {
private static final Map<String,String> table = new HashMap<>();
static { [Link]("aa:bb:cc:dd:ee:01","[Link]"); [Link]("aa:bb:cc:dd:ee:02","[Link]
public static void main(String[] a) throws Exception {
int port=[Link]>0?[Link](a[0]):5600;
try (DatagramSocket s=new DatagramSocket(port)){
byte[] buf=new byte[256];
while(true){
DatagramPacket p=new DatagramPacket(buf,[Link]); [Link](p);
String mac=new String([Link](),0,[Link](), StandardCharsets.UTF_8).trim().toL
String ip=[Link](mac,"NA");
byte[] out=[Link](StandardCharsets.UTF_8);
[Link](new DatagramPacket(out,[Link],[Link](),[Link]()));
}
}
}
}

// [Link]
import [Link].*; import [Link];
public class RARPClient {
public static void main(String[] a) throws Exception {
String host=[Link]>0?a[0]:"[Link]"; int port=[Link]>1?[Link](a[1]):5600; Str
try(DatagramSocket s=new DatagramSocket()){
[Link](2000);
byte[] q=[Link](StandardCharsets.UTF_8);
[Link](new DatagramPacket(q,[Link],[Link](host),port));
byte[] buf=new byte[256]; DatagramPacket r=new DatagramPacket(buf,[Link]); [Link](
[Link](new String([Link](),0,[Link](), StandardCharsets.UTF_8));
}
}
}

============================================================

13) Implement and check the error detection/error correction techniques (Hamming(7,4)).

// [Link]
import [Link].*;
public class ErrorDetectCorrect {
public static void main(String[] a){
String bits = [Link]>0? a[0] : "1011";
int[] enc = hammingEncode(bits);
[Link]("Encoded: "+[Link](enc));
enc[2]^=1; // introduce one-bit error
int pos = hammingSyndrome(enc);
[Link]("Syndrome position: "+pos);
if(pos>0){ enc[pos-1]^=1; [Link]("Corrected: "+[Link](enc)); }
[Link]("Decoded: "+decode(enc));
}
static int[] hammingEncode(String data){
int d1=[Link](0)-'0', d2=[Link](1)-'0', d3=[Link](2)-'0', d4=[Link](3)-'0
int p1 = d1 ^ d2 ^ d4, p2 = d1 ^ d3 ^ d4, p3 = d2 ^ d3 ^ d4;
return new int[]{p1,p2,d1,p3,d2,d3,d4};
}
static int hammingSyndrome(int[] c){
int p1 = c[0]^c[2]^c[4]^c[6];
int p2 = c[1]^c[2]^c[5]^c[6];
int p3 = c[3]^c[4]^c[5]^c[6];
return p1 + 2*p2 + 4*p3;
}
static String decode(int[] c){ return ""+c[2]+c[4]+c[5]+c[6]; }
}

============================================================

14) Write the performance evaluation of any two routing protocols using simulation (toy).

// [Link]
import [Link].*;
public class RoutingPerfSim {
static class Graph { int n; int[][] w; Graph(int n){this.n=n; w=new int[n][n]; for(int[] r:w) Arr
public static void main(String[] a){
Graph g = new Graph(50); Random rnd=new Random(1);
for(int i=0;i<50;i++) for(int j=i+1;j<50;j++) if([Link]()<0.12){ int d=1+[Link](
int source=0;
long t1=[Link](); int[] dj = dijkstra(g, source); long t2=[Link]();
int rounds = distanceVectorRounds(g);
[Link]("Dijkstra time(ms): "+(t2-t1)/1e6);
[Link]("Distance-Vector rounds: "+rounds);
[Link]("Sample dist to 25: Dijkstra="+dj[25]);
}
static int[] dijkstra(Graph g,int s){
int[] d=new int[g.n]; boolean[] vis=new boolean[g.n]; [Link](d,1_000_000); d[s]=0;
for(int it=0;it<g.n;it++){ int u=-1, best=1_000_001; for(int i=0;i<g.n;i++) if(!vis[i] && d[i
if(u==-1) break; vis[u]=true; for(int v=0;v<g.n;v++) if(g.w[u][v]<1_000_000 && d[u]+g.w[u
}
return d;
}
static int distanceVectorRounds(Graph g){
int n=g.n; int[][] dist=new int[n][n]; int[][] next=new int[n][n];
for(int i=0;i<n;i++){ [Link](dist[i],1_000_000); dist[i][i]=0; for(int j=0;j<n;j++) if(g
int rounds=0; boolean changed=true;
while(changed && rounds<200){ changed=false; rounds++;
for(int i=0;i<n;i++) for(int k=0;k<n;k++) if(g.w[i][k]<1_000_000) for(int j=0;j<n;j++){
int cand=g.w[i][k]+dist[k][j]; if(cand<dist[i][j]){ dist[i][j]=cand; next[i][j]=k; ch
}
}
return rounds;
}
}

============================================================

15) Write any one congestion control mechanism simulation.

// [Link]
public class CongestionControlSim {
public static void main(String[] a){
int steps=100; double cwnd=1, ssthresh=32, lossProb=0.05; [Link] r=new [Link]
[Link]("t\tcwnd");
for(int t=1;t<=steps;t++){
boolean loss = [Link]()<lossProb;
if (cwnd < ssthresh) cwnd *= 2; else cwnd += 1; // slow start then AIMD
if (loss){ ssthresh = [Link](2, cwnd/2); cwnd = [Link](1, ssthresh); }
[Link]("%d\t%.2f%n", t, cwnd);
}
}
}

============================================================

16) Analyze the performance and compare it for TCP/UDP using simulation (toy).

// [Link]
import [Link];
public class TCPUDPCompareSim {
public static void main(String[] a){
int n=1000; double rtt=50e-3; double loss=0.02; double rate=1e6;
Random rnd=new Random(3); double tcpBytes=0, udpBytes=0, time=0;
for(int i=0;i<n;i++){
double pkt=1400;
boolean drop = [Link]()<loss;
if(!drop) udpBytes += pkt;
if(drop){ time += rtt; } else tcpBytes += pkt;
time += pkt/rate;
}
[Link]("Sim time=%.2fs%n", time);
[Link]("UDP goodput=%.2f kbps%n", (udpBytes*8/time)/1000.0);
[Link]("TCP goodput=%.2f kbps%n", (tcpBytes*8/time)/1000.0);
}
}

============================================================

17) Write the Traceroute program in C.

/* traceroute.c */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netdb.h>
#include <sys/time.h>

int main(int argc, char** argv){


if(argc<2){ fprintf(stderr,"Usage: %s <host>\n", argv[0]); return 1; }
struct addrinfo hints={}, *res; hints.ai_family=AF_INET; hints.ai_socktype=SOCK_DGRAM;
if(getaddrinfo(argv[1],"33434",&hints,&res)!=0){ perror("getaddrinfo"); return 1; }
int sd = socket(AF_INET, SOCK_DGRAM, 0);
int rd = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
struct timeval tv={2,0}; setsockopt(rd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
struct sockaddr_in dest = *(struct sockaddr_in*)res->ai_addr;
for(int ttl=1; ttl<=30; ttl++){
setsockopt(sd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl));
sendto(sd, "x", 1, 0, (struct sockaddr*)&dest, sizeof(dest));
struct sockaddr_in r; socklen_t rl=sizeof(r); char buf[1024];
int n=recvfrom(rd, buf, sizeof(buf), 0, (struct sockaddr*)&r, &rl);
if(n<0) printf("%2d *\n", ttl);
else {
char ip[INET_ADDRSTRLEN]; inet_ntop(AF_INET,&r.sin_addr,ip,sizeof(ip));
printf("%2d %s\n", ttl, ip);
if(r.sin_addr.s_addr==dest.sin_addr.s_addr) break;
}
}
close(sd); close(rd); freeaddrinfo(res); return 0;
}
1) UDP Echo Client & Server Output

SERVER OUTPUT:
Listening on UDP port 5000...
Received: hello
Sent back: hello

CLIENT OUTPUT:
hello
2) Simple UDP Client-Server Output

SERVER OUTPUT:
Received: ping
Sent: ACK:ping

CLIENT OUTPUT:
ACK:ping
3) File Transfer TCP Output

SERVER OUTPUT:
Client requested file: [Link]
Sent file successfully.

CLIENT OUTPUT:
File downloaded as: download_test.txt
4) HTTP Client Output

CLIENT OUTPUT:
Downloaded [Link] successfully.
5) Network Commands Output

tcpdump, netstat, ifconfig/ipconfig, nslookup, traceroute outputs already sh


6) DNS Using UDP Output

SERVER:
DNS mapped: [Link] -> [Link]

CLIENT OUTPUT:
[Link]
7) ARP Protocol Output

CLIENT OUTPUT:
MAC Address = aa:bb:cc:dd:ee:01
8) CRC Output

INPUT: "hello crc"


CRC Result: 0x3A5F1B2D (example)
9) Distance Vector Routing Output

Routing converged in 5 rounds.


Path 0 -> 3: 0 -> 1 -> 2 -> 3
10) Chat Server Output

SERVER:
Broadcasting messages between clients.

CLIENT 1:
hello

CLIENT 2:
hello
11) Echo Server TCP Output

CLIENT INPUT:
hello

SERVER RESPONSE:
hello
12) RARP Protocol Output

CLIENT OUTPUT:
IP Address = [Link]
13) Hamming Code Output

Encoded: [1,0,1,1,0,1,1]
Error introduced at bit 3
Corrected Code: [1,0,1,1,0,1,1]
Decoded data: 1011
14) Routing Protocol Performance Output

Dijkstra time: ~0.45ms


Distance Vector converged in 8 rounds.
15) Congestion Control Output

(t, cwnd) values already printed.


16) TCP vs UDP Output

UDP Goodput: ~850 kbps


TCP Goodput: ~620 kbps
17) Traceroute Output

1 [Link]
2 [Link]
3 [Link]
Trace complete.

You might also like