java socket输出byte[]
时间: 2023-12-24 14:02:34 浏览: 57
java socket学习
可以通过OutputStream将byte[]写入Socket中,示例代码如下:
```java
Socket socket = new Socket("localhost", 8080);
OutputStream outputStream = socket.getOutputStream();
byte[] messageBytes = "Hello, World!".getBytes();
outputStream.write(messageBytes);
```
阅读全文