I am using this snippet of Java code to send data to a port. If I execute the two close commands the receiver reading from the port throws a bind error: "Unrecognized Windows Sockets error: 0: JVM_Bind"
If I never execute the two close commands, the reader gets the data just fine.
I assume I must close the PrintWriter and echoSocket eventually...but how do I know when the receiver has read all the data so I can close?
Socket echoSocket = new Socket(servername, Tx.getPortNumber());
PrintWriter out = new PrintWriter(echoSocket.getOutputStream(), true);