I am working on the networking phase of my hl7 application. I am testing by
creating two instances of my application on the same computer with different
sets of data. One is set to send data and the other to receive data. I am
using the SimpleServer. My code is basically a replica of the the send and
receive example code in the hapi by example section.
I am able to make my first round trip without a problem. But when i try to do
a second i get a socket closed error:
java.net.SocketException: Socket closed
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(Unknown Source)
at sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(Unknown Source)
at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(Unknown Source)
at sun.nio.cs.StreamEncoder.flush(Unknown Source)
at java.io.OutputStreamWriter.flush(Unknown Source)
at java.io.BufferedWriter.flush(Unknown Source)
at ca.uhn.hl7v2.llp.MinLLPWriter.writeMessage(MinLLPWriter.java:93)
at ca.uhn.hl7v2.app.Initiator.sendAndReceive(Initiator.java:114)
After a bit of fiddling I discovered that if I don't close the connection on
the senders side then this problem goes away. But I don't understand this. I
would think that if I close the connection that is transmitting the message and
receiving the response, that it would not close the server. I would think the
server would just remain open listening for more connections. If this were a
remote connection instead of on my localhost I would think the remote box would
want to close the connection.
I also get this error if I stop and start my server.
What am I doing wrong? Does this have to do with me using localhost as the
receiver and transmitter? I may need to do this on some occasions so is there
a way around?
thanks
-Ryan
_________________________________________________________________
Share life as it happens with the new Windows Live.
http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel