I have a Socket listening on some x port.
I can send the data to the socket from my client app but unable to get any response from the server socket.
-
For me this code is strange:
bis.readLine()
As I remember, this will try to read into a buffer until he founds a '\n'
. But what if is never sent?
My ugly version breaks any design pattern and other recommendations, but always works:
int bytesExpected = clientSocket.available(); //it is waiting here
int[] buffer = new int[bytesExpected];
int readCount = clientSocket.read(buffer);
You should add the verifications for error and interruptions handling too.
With webservices results this is what worked for me ( 2-10MB was the max result, what I have sent)
- 热议问题