Hi everyone,
I am trying to send some values from my iiwa to my Laptop using UDP. I followed simple tutorials for sending a String to an external machine. The Robot class for sending the packets Looks like this:
Java
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class UDPClient {
private int port = 30001;
byte[] ControllerIP={(byte)172,31,1,(byte)147}; //IP cabinet
private byte[] bufferO = new byte[1024];
InetAddress address;
public void startClient(){
try {
address = InetAddress.getByAddress(ControllerIP);
String msg = "AA" ;
bufferO = msg.getBytes();
DatagramSocket Socket = new DatagramSocket();
DatagramPacket packet = new DatagramPacket(bufferO, bufferO.length, address, port);
Socket.send(packet);
Socket.close();
} catch (UnknownHostException e) {
e.printStackTrace();
}
//catch (InterruptedException e) { e.printStackTrace(); }
catch (IOException e) {
e.printStackTrace();
}
}
}
Display More
and on the PC side I created a simple listener in python but it never receives any data:
Code
import socket
Udp_Port = 30001
SocketS = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
SocketS.bind(('', Udp_Port))
while True:
print("Waiting for the message: ")
data = SocketS.recvfrom(1024)
print("received message: ", data)
Display More
My Laptop is directly connected to the X66 port of the cabinet and I have tried in AUT, T1 but still doesnt work. Is there any configuration I have to do in sunrise or do you have any idea why it is not working?
Tnhanks in advance