Open CircleZhou opened 4 years ago
Write a python code (or use any scripting language) like this
#ip address that use during tunslip6 command
UDP_LOCAL_IP = 'fd00::1'
UDP_LOCAL_PORT = 1234
#IPV6 address of node from which you want to get the data
UDP_REMOTE_IP = 'XXX::XXX'
#check the port
UDP_REMOTE_PORT = 1324
try:
socket_rx = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
socket_rx.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
socket_rx.bind((UDP_LOCAL_IP, UDP_LOCAL_PORT))
except Exception:
print "ERROR: Server Port Binding Failed"
print 'UDP server ready: %s'% UDP_LOCAL_PORT
print
while True:
data, addr = socket_rx.recvfrom(1024)
print "address : ", addr
print "received message: ", data
print "\n"
socket_rx.sendto("Hello from serevr\n", (UDP_REMOTE_IP, UDP_REMOTE_PORT))
hopefully this helps. -Anesh
I have done rpl-border-router.c as router on sky mote and 1 udp-server.c mote on sky in cooja. I connect router using tunslip utility.
I can ping my server as well as router.
I want to send udp data to server via my linux as host via tun0, but i cant manage to send on it. I have notice that by ping from terminal it works , How to send packet to my server via border router from linux as host.