Bytestuff CN
Bytestuff CN
Khushi Sachdev
CSE
2100290100087
Q1. Wap byte stuffing and byte unstuffing and implement along client and
server program
ALONG CLIENT SIDE
package byte_stuffing;
import java.io.*;
import java.util.*;
import java.net.*;
InetAddress ip = InetAddress.getLocalHost();
while (true) {
else
dos.writeUTF(res);
System.out.println("Seding Message....");
if (dis.readUTF().equals("success"))
// End Messaging
dos.writeUTF("bye");
break;
s.close();
dis.close();
dos.close();
package byte_stuffing;
import java.io.*;
import java.net.*;
{
// Opens a socket for connection
while (true) {
System.out.println("Message Received...Successfully!!!");
i++;
dos.writeUTF("success");
String ch = dis.readUTF();
if (ch.equals("bye")) {
System.out.println("Messaging is over.....EXITING");
break;
dis.close();
dos.close();