My question is if the same InputStream
is provided to both Client and Server.
In my Server side I have:
final socket finalAccept=myServerSocket.accept();
finalAccept.getInputStream();
for the client(which is multithreaded)i have:
HttpURLConnection.getInputStream();
now can it happen that both of them simultaneously read the InputStream resulting in data corruption
actually my server is NANOHttpd server and client is my implementation.Upto 10-12 runs request,response is okay,but after that the client read data is empty and so is the server's inputstream.available()=0.can it be the above specified problem
No, the InputStream
of the client receives the data from the OutputStream
of the server, and vice versa. That's the whole point - each side receives the data sent from the other.
See more on this question at Stackoverflow