how to send an array of bytes over a TCP connection (java programming)

前端 未结 9 1764
粉色の甜心
粉色の甜心 2020-12-13 14:45

Can somebody demonstrate how to send an array of bytes over a TCP connection from a sender program to a receiver program in Java.

byte[] myByteArray
<         


        
9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-13 15:26

    What you need to use is the write method of an java.io.OutputStream, and the read method of an java.io.InputStream, both of which you can retrieve from the Socket you open.

提交回复
热议问题