Hello I am working with sockets in Java and I have run into a problem. I have created a DataInputStream and PrintStream in my client side and I'm attempting to create and ObjectOutputStream and ObjectInputStream for the same socket (the PrintStream is for text the ObjectOutputStream and ObjectInputStream are for pieces that will be used in a game I'm making). The program makes an ObjectOutputStream and the Server says a connection was made, however, the client hangs when it gets to ObjectInputStream.Is there anyway I can stop the hanging (it is possible to have multiple input and output streams to the same socket).
Socket sock = new Socket("127.0.0.1", 1716);
InputStream majora = sock.getInputStream();
OutputStream mask = sock.getOutputStream();
input = new DataInputStream(majora);
printer = new PrintStream(mask);
System.out.println("Test 1");
link = new ObjectOutputStream(mask);
link.flush();
System.out.println("Test 2");
zelda = new ObjectInputStream(majora);
System.out.println("Test 3");