2019wb86174 CSIWZC467 Assignment
2019wb86174 CSIWZC467 Assignment
2019wb86174 CSIWZC467 Assignment
CSIWZC467
COMPUTER NETWORKS
GROUP NO. 05
Kaviyarasan J
Revathi K
Pavithra S
----------------------------------------------------------------------------------------------------------------
Question:
Create a socket for HTTP for web page upload and download.
Aim:
To write a java program for socket for HTTP for web page upload and download .
Algorithm
5.If your frames reach the server it will send ACK signal to client otherwise it will send
NACK signal to client.
Program :
Client
import javax.swing.*;
import java.net.*;
import java.awt.image.*;
import javax.imageio.*;
import java.io.*;
soc=new Socket("localhost",4000);
try {
baos.flush();
dos.writeInt(bytes.length);
dos.write(bytes, 0, bytes.length);
dos.close();
out.close();
soc.close();
soc.close();
}
Server
import java.net.*;
import java.io.*;
import java.awt.image.*;
import javax.imageio.*;
import javax.swing.*;
class Server {
ServerSocket server=null;
Socket socket;
server=new ServerSocket(4000);
InputStream in = socket.getInputStream();
dis.close();
in.close();
l.setIcon(icon);
f.add(l);
f.pack();
f.setVisible(true);