There is a Java server and a C # client. The server catches client connection requests using ServerSocket, then for each new client it creates a new stream with its personal socket. The client connects to the server via TCPClient.
Socket I / O streams on the server are converted to DataInputStream and DataOutputStream for convenience, to the client this is NetworkStream .
Server sources that may be useful
Client sources that may be useful
Actually, the problem is : if the client authorization is traced on the client and paused before reading the result code, then everything is fine. If you run without breakpoints, the client cannot read an integer from the stream β the result code and hangs waiting for it, although it is sent by the server correctly.
Tell me, where do the data from the stream go? Maybe I use flush wrong? How to implement this exchange correctly?
readStringchangereadtoreadFully,readdoes not guarantee that the entire buffer will be filled upon completion. when creating a string from an array, explicitly specify the encoding in the constructor, by default it is system-wide. - zRrr