Client implementation
import java.net.Socket;
public class MyClient {
public static void main(
String[] args) {
try {
Socket socket = new Socket("127.0.0.1", 20000);
} catch(Exception e) {
// Exercise: Figure out the individual exceptions that can be thrown and when and why it would happen
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
server implementation
import java.net.ServerSocket;
public class MyServer {
public static void main(String[] args) {
try {
ServerSocket server = new ServerSocket(20000); // bind to the port
} catch(Exception e) {
// Exercise: again, catch the individual exceptions and learn how and why they're thrown
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
Server is run..Then the client is run..Both get connected..But at the end when the netstat is used..the port 20000 is not shown..why is that? Please help me