Isn't that obvious? You hard-code some array size to 10025. Why? You should never do it. No wonder, if you try to read some amount of data of some other size, such as
(int)clientSocket.ReceiveBufferSize
, into your buffer, that buffer may be not big enough.
Apparently, if will be just write if you create it without hard-coding based on required size:
int size
int size = (int)clientSocket.ReceiveBufferSize;
byte[] inStream = new byte[size];
serverStream.Read(inStream, 0, size);
Good luck.
—SA