Vote count:
0
I use this code to connect a device with ip, But doesn't work.
Sender:
InetAddress inet=InetAddress.getByName("0.0.0.0");
DatagramSocket socket=new DatagramSocket();
DatagramPacket packect=new DatagramPacket("ali".getBytes(), 3, inet, 400);
socket.send(packect);
receiver :
DatagramSocket socket=new DatagramSocket(400);
byte[] buffer=new byte[10];
DatagramPacket packet=new DatagramPacket(buffer, buffer.length);
socket.receive(packet);
buffer=packet.getData();
asked 1 min ago
Send data to specific ip address in java
Aucun commentaire:
Enregistrer un commentaire