import java.net.*;
import java.io.*;
public class Server{
public static void main(String[] args) throws Exception{
ServerSocket serversocket=new ServerSocket(8888);
Socket socket=serversocket.accept();
InputStream in=new FileInputStream("C:/Test/test.txt");
OutputStream outstream=socket.getOutputStream();
int len=0;
byte buffer[]=new byte[1024];
while((len=in.read(buffer))>0){
outstream.write(buffer,0,len);
}
in.close();
outstream.close();
socket.close();
serversocket.close();
}
}