Hey Guys,
I've made programs that use ObjectInput/ObjectOutputStreams across Socket Connections to send Serialized Objects across the line before, but for some reason with this latest program I'm working on the connection is just hanging when it should be establishing these streams.
Here's the code on the Server Side:
private final boolean setup() { //Setup Input Streams try{ ois = new ObjectInputStream(socket.getInputStream()); // <- Hanging Here }catch(Exception e){ e.printStackTrace(); return false; } //Setup Output Streams try{ oos = new ObjectOutputStream(socket.getOutputStream()); }catch(Exception e){ e.printStackTrace(); return false; } return true; }
And the Client Side (Essentially the Same):
private final boolean setup() { //Attempt Connection try{ socket = new Socket(serverName, PORT); }catch(Exception e){ e.printStackTrace(); return false; } //Setup Streams // - Input try{ ois = new ObjectInputStream(socket.getInputStream()); <- Hanging Here }catch(Exception e){ e.printStackTrace(); return false; } // - Output try{ oos = new ObjectOutputStream(socket.getOutputStream()); }catch(Exception e){ e.printStackTrace(); return false; } //Return return true; }
If someone could help me out with this I'd appreciate it 'cause I can't figure out for the life of me what's wrong. The code seems right, and when I run both programs the two connect to one another, they just hang when they should be establishing those object streams.
Thanks!