0
我正在使用UDP客户端发送每秒约20k个请求,每个请求的数据为1k个<。我需要通过Java实现一个UDP服务器。 编码类似以下内容:有没有办法让UDP丢包率降低?
public void startRecieve() throws IOException {
udpSocket = new DatagramSocket(Constant.PORT);
byte[] buffer = new byte[Constant.SIZE];
udpPacket = new DatagramPacket(buffer, buffer.length);
int len;
while (true) {
udpSocket.receive(udpPacket);
len = udpPacket.getLength();
if (len > 0) {
// handing the data using other thread pool
}
}
}
有没有什么办法让UDP服务器丢包是低?
谢谢。
安装光纤电缆并隔离它以防止噪音,这应该有所帮助。 –
感谢您的快速评论。有没有编程建议? – andy
你对此有何评论?你怎么知道丢失的包? – Malkocoglu