我有一个客户端和服务器,我可以将数据发送到服务器,但我需要帮助我如何使用从客户端接收的数据来绘制图形,使用Plot2DPanel / JMathPlot。关于如何将从客户端接收的数据分配给Plot2DPanel的简单代码。我有下面的代码,它从客户端接收数据,但我不知道如何在Plot2DPanel上使用它。
while(true){
System.out.println("Waiting for the incoming mesages" +portNumber+ "....");
receiveSocket.receive(receivedPacket);
IAddress address = receivedPacket.getAddress();
int clientPort = receivedPacket.getPort();
String message = new String(receivedPacket.getData());
message = message.trim();
System.out.println("The message {+mesage+}.\n\t\t The message is received from host: " +IAddress+ "on port" + portNumber);
byte[] sendData = new byte[256];
String sendBackMessage = "Thank you, message was received";
sendData = sendBackMessage.getBytes();
receivedPacket = new DatagramPacket(sendData, sendData.length, IAddress, clientPort);
receiveSocket.send(receivedPacket);