我这边用一个简单的udp client的python脚本在PC机器下作为激励,把在你引用的那个代码在ZCU102上运行,得到打印反馈,可以得到IP地址:
root@xilinx-zcu102-2018_2:/run/media/mmcblk0p1# ./udp_test.elf 21567
server received datagram from x.x.x.x (x.x.x.x)
server received 2/2 bytes: hi
python代码如下:#!/usr/bin/env python
from socket import *
HOST = 'x.x.x.x'
PORT = 21567
BUFSIZ = 1024
ADDR = (HOST, PORT)
udpCliSock = socket(AF_INET, SOCK_DGRAM)
while True:
data = raw_input('> ')
if not data:
break
udpCliSock.sendto(data, ADDR)
data, ADDR = udpCliSock.recvfrom(BUFSIZ)
if not data:
break
print data
udpCliSock.close()
注意:打印和代码中的IP地址和主机名我都用X代替了,需要根据需要自己填充
Best Regards,
Jason
-----------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if the information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
-----------------------------------------------------------------------------------------------