Hi Ryan,
I had a problem looking like your. At the end you said that you get the 
same when you stop and start your server. This seems that you get your 
connection with the ConnectionHub.attach(...) and you end with a 
detach(). The detach doesn't close the connection i think. So when you 
shutdown your server, and then call ConnectionHub.attach() it returns 
your socket privious instance, taht was closed by your server shutdown. 
instead of detach()  you can try to use discard(). Or check before, if 
you can access you socket state, if it is closed or not. Hope it helps 
because i'm not an expert...
Yves

I am working on the networking phase of my hl7 application. I am testing b=
y creating two instances of my application on the same computer with differ=
ent 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 se=
nd and receive example code in the hapi by example section. =20

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 o=
n the senders side then this problem goes away. But I don't understand thi=
s. I would think that if I close the connection that is transmitting the m=
essage and receiving the response, that it would not close the server. I w=
ould think the server would just remain open listening for more connections=
. If this were a remote connection instead of on my localhost I would thin=
k the remote box would want to close the connection. =20

I also get this error if I stop and start my server. =20

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 t=
here a way around? =20


thanks
-Ryan

-- 
Yves VIOT
C.S.I.S.
130 rue Eugene POTTIER
35200 RENNES
Mail       :[EMAIL PROTECTED]
T(Direct)  :0952-170-963 (non surtaxé)
T(Siège)   :02-23-35-43-55
F(Siège)   :02-23-35-43-56
________________
CONFIDENTIALITE : Ce message et les éventuelles pièces attachées sont 
confidentiels. Si vous n'êtes pas dans la liste des destinataires, veuillez 
informer l'expéditeur immédiatement et ne pas divulguer le contenu à une tierce 
personne, ne pas l'utiliser pour quelque raison que ce soit, ne pas stocker ou 
copier l'information qu'il contient sur un quelconque support. 


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to