I guess here are some sockets. I would suspect that the Java implementation simply closes the client socket, which may cause an error on the server, while the C # version is a bit more server friendly and waits for it to confirm the close request. Since the server is busy shutting down data, it does not receive, or at least does not process, a shutdown request until it completes the sending.
Think of it this way: someone in front of you is trying to sell you something and will not be interrupted. You can slam the door on the face that closes them immediately, or you can wait until they finish the conversation, and then ask them to leave.
To solve this problem, perhaps you can create a worker thread that opens the thread, waits for 100 bytes, and then closes. In the meantime, your program can do whatever it takes while the thread eventually shuts down.
source share