How can I send data in binary form over a Java socket?

后端 未结 3 1879
感情败类
感情败类 2020-12-18 06:46

I\'ve seen lots of examples of sending serialized data over sockets in Java, but all I want is to send some simple integers and a string. And, the problem is I\'m trying to

3条回答
  •  别那么骄傲
    2020-12-18 07:21

    You can use the simple OutputStream given by the Socket.
    From there you can write bytes.

    If you want you can also encapsulate this stream in a BufferedOutputStream to have a buffer.

提交回复
热议问题