A
Alex
I try to make simple Client/Server connection wrapped in XML.
So, I create XML request, open connection to the server and send it.
On the server side XML (as ImputStream) is rterieved by
DocumentBuilder.parse().
It means that to finish parse InputStream should be closed.
That's what I do from Client side. Send XML and do
socket.shutdownOutput();
Only after this DocumentBuilder (on server side) finishes its work and
returns Documnent.
But then I want to create XMl answer and send it back for Client.
But both halfs of the socket are already closed.
Don't know why.
On Client side it says:
isInputShutdown=false isOutputShutdown=true
On server side:
isInputShutdown=false isOutputShutdown=false
Server: send the answer xml
Server: java.net.SocketException: Socket closed
I expect that Input and Output halfs of the socket from both sides work
separately but it looks that when I close or OutputShutdown output it
closes both streams.
Looks strange for me.
Any ideas?
Any other way to communicate Client/Server with sending/receiving XML?
Of course I can read input, store it, wait for end of XML, create
virtual InputStream (not closing socket's one), have Document, create
Document-Answer, write it back and only then close both input/output.
But it doesn't look elegant.
So, any suggestions?
Alex.
So, I create XML request, open connection to the server and send it.
On the server side XML (as ImputStream) is rterieved by
DocumentBuilder.parse().
It means that to finish parse InputStream should be closed.
That's what I do from Client side. Send XML and do
socket.shutdownOutput();
Only after this DocumentBuilder (on server side) finishes its work and
returns Documnent.
But then I want to create XMl answer and send it back for Client.
But both halfs of the socket are already closed.
Don't know why.
On Client side it says:
isInputShutdown=false isOutputShutdown=true
On server side:
isInputShutdown=false isOutputShutdown=false
Server: send the answer xml
Server: java.net.SocketException: Socket closed
I expect that Input and Output halfs of the socket from both sides work
separately but it looks that when I close or OutputShutdown output it
closes both streams.
Looks strange for me.
Any ideas?
Any other way to communicate Client/Server with sending/receiving XML?
Of course I can read input, store it, wait for end of XML, create
virtual InputStream (not closing socket's one), have Document, create
Document-Answer, write it back and only then close both input/output.
But it doesn't look elegant.
So, any suggestions?
Alex.