I
I
Ivan Ivanov2018-03-17 22:44:08
Java
Ivan Ivanov, 2018-03-17 22:44:08

Why java socket doesn't forward data and hangs on socket.getInputStream() on windows 10?

Wrote a simple java code to send data via socket:
server:

try{
   ServerSocket ss=new ServerSocket(6667);
   Socket s=ss.accept();
   ObjectInputStream io=new ObjectInputStream(s.getInputStream());
   ObjectOutputStream oo=new ObjectOutputStream(s.getOutputStream());
   oo.writeObject("hello world!!!");
}catch(Exception e)
{}

client:
try{
   Socket socket=new Socket(InetAddress.getByName("127.0.0.1"),6667);
   ObjectInputStream io=new ObjectInputStream(socket.getInputStream());
   ObjectOutputStream oo=new ObjectOutputStream(socket.getOutputStream());
   System.out.println((String)io.readObject());
}catch(Exception e)
{}

I checked on windows xp with jdk 8 everything works, but it does not work on windows 10. The question is why.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question