import java.io.*;
import java.net.*;
public class Client1
{
public static void main(String args[])throws IOException
{
try
{
Socket socket=new Socket("59.177.97.229",5001);
DataInputStream dis=new DataInputStream(socket.getInputStream());
String a=dis.readUTF();
System.out.println("msg from server"+a);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
import java.io.*;
import java.net.*;
public class Server1
{
public static void main(String args[])throws IOException
{
ServerSocket l=new ServerSocket(5001);
try{
Socket socket=l.accept();
try
{
OutputStream sout=socket.getOutputStream();
DataOutputStream dos=new DataOutputStream(sout);
dos.writeUTF("\n hello this is server");
}
catch(Exception e)
{
System.out.println(e);
}
}
catch(Exception e)
{
System.out.println(e);
}
}
}
ERROR :
connection time out in client