You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Using TCP/IP sockets, write a client – server program to make the client send the file name and to make the server send back the contents of the requested file if present.
import java.util.*;
import java.net.*;
import java.io.*;
public class TCPS{
public static void main(String[] args) throws Exception{
ServerSocket sersock=new ServerSocket(4000);
System.out.println("Server is ready for connection");
Socket sock=sersock.accept();
System.out.println("Connection is established and server is waiting for client request");