int port = 18000;
DatagramSocket serverSocket = new DatagramSocket(port);
byte[] receiveData = new byte[8];
System.out.println("Server Listing on Port: "+port);
String x;
while (true){
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
serverSocket.receive(receivePacket);
?? ??雙X =新Doulbe.parseBytes(recievedPacket)Java如何解析接收到的UDP字節中的double值?
用'雙緩衝試試'。 –
我喜歡你的實現。我自己也使用同樣的東西:p – ThePixelPony