![](/img/trans.png)
[英]How the server knows the port number of the client in which it will use it to send the responses to the client using java programming socket?
[英]How to send a byte in java without using the regular client - server socket programming?
我有一个要求,我需要测试发送几个字节所需的时间。 但是,我不想编写套接字程序并跳入复杂性,而只是想将字节“转为黑暗”,而不用关心是否建立连接或接收到字节。 我唯一的目的是测量程序发送这么多字节所需的时间。 实现这样的最佳方法是什么?
UDP应该做您想要的。 您可以在Java中使用DatagramSocket 。
UDP是一种网络协议,它在发送数据之前不会建立连接,并且没有任何(内置)方式来确保对方已接收到它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.