I am just working on my assignment of client-server and found an program online of a server.java as:
import java.io.*;
import java.net.*;
public class MyServer{
public static void main(String [] args){
try{
ServerSocket ssc = new ServerSocket(7500);
Socket newSsc = ssc.accept();
DataInputStream din = new DataInputStream(newSsc.getInputStream());
DataOutputStream dout = new DataOutputStream(newSsc.getOutputStream());
PrintWriter pw = new PrintWriter(dout);
pw.println("Hello! Welcome to vinit's server.");
boolean more_data = true;
while(more_data){
String line = din.readLine();
if(line == null){
more_data = false;
}
else{
pw.println("From Server "+line + "\n");
System.out.println("From Client "+line);
if(line.trim().equals("QUIT"))
more_data = false;
}
}
newSsc.close();
}
catch(IOException e){
System.out.println("IO error");
}
}
}
THen after I used this server by typing the command as
$ telnet 127.0.0.1 7500
Now I want to ask how my server will be getting null from client, i mean what should be entered so that server will get null
Thanks in Advance.