Finding remote IP of answering device over UDP
a.theofilu
Posts: 16
I've here a socket controllable over WiFi. To communicate with the socket, I first must find out the IP address the socket got over DHCP. This is done with a broadcast call over UDP. The socket answers, but the answer doesn't contain the IP address. Normaly this isn't necessary, because the IP address of the socket is part of the header of the datagram. But I couldn't find a way in Netlinx to get this remote IP address and in the forums here I found some similar questions, but no useable answers.
However: Is there a way to get the remote IP address in Netlinx?
I could write this module in Duet also, but it is such a simple protocol and I don't want to write it in Duet if not necessary.
Btw: It is not possible to set the socket to a fixed IP address. The whole communication is over UDP only. First thing to do is a broadcast call to find all the sockets in the network. Then I've to find out the IP address of the sockets and their MAC addresses. The MAC address is always part of the commands and is contained in every answer of the socket. Of course I could configure the DHCP server so that it gives every socket a fixed IP address, but this is not the way the protocol is meant and would make the module less flexible.
A.T.
However: Is there a way to get the remote IP address in Netlinx?
I could write this module in Duet also, but it is such a simple protocol and I don't want to write it in Duet if not necessary.
Btw: It is not possible to set the socket to a fixed IP address. The whole communication is over UDP only. First thing to do is a broadcast call to find all the sockets in the network. Then I've to find out the IP address of the sockets and their MAC addresses. The MAC address is always part of the commands and is contained in every answer of the socket. Of course I could configure the DHCP server so that it gives every socket a fixed IP address, but this is not the way the protocol is meant and would make the module less flexible.
A.T.
0
Comments