InetAddress host = InetAddress.getLocalHost();
Socket link = new Socket(host, Integer.parseInt(args[0]));
System.out.println("before input stream");
ObjectInputStream in = new ObjectInputStream(link.getInputStream());
System.out.println("before output stream");
ObjectInputStream out = new ObjectOutputStream(link.getOutputStream());
"before input stream" is the last lifesign on cmd-line. There is no Exception thrown. Why is this happening? I don't understand...
args[0] is 5000. //edit: flush doesn't help.
This is because the ObjectInputStream(InputStream in)
-constructor is a blocking-call if the inputStream is empty.
Quote:
Creates an ObjectInputStream that reads from the specified InputStream. A serialization stream header is read from the stream and verified. This constructor will block until the corresponding ObjectOutputStream has written and flushed the header.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With