Under linux test ZLAN 5800

Today, the brothers let help test ZLAN 5800 eight serial communication module, according to the manual test under the windows have to get to the next test under Linux.
Because manufacturers do not provide relevant information under Linux, so it directly to the need to set up in the windows were TCP / IP test, IP address for the manufacturers to provide a virtual serial port can not be used under Linux operating environment of the (fortunately next project also less than)

1. Check the com port

ls -l /dev/ttyUSB*

2. Open cutecom

There have been problems related to open com, this time using sudo cutecomopen cutecom

3. Open the TCP / IP communications client program

from socket import *
# 走到这一步就已经建立连接完毕,接下来开始数据通信:
#client.send('hello server'.encode('utf-8'))    # 将发送的信息转码成Bytes类型数据
client = socket(AF_INET, SOCK_STREAM) # 这里的SOCK_STREAM代表的就是流式协议TCP,如果是SOCK_DGRAM就代表UDP协议
# 开始连接服务端IP和PORT,建立双向链接
client.connect(('192.168.1.200', 4196))  # 通过服务端IP和PORT进行连接
while True:
    client.send('hello world 1'.encode('utf-8'))  # 将发送的信息转码成Bytes类型数据
    data = client1.recv(1024)  # 每次最大收数据大小为1024字节(1kb)
    print(data.decode('utf-8'))  # 将b类型数据转换成字符串格式

4. Test

Guess you like

Origin www.cnblogs.com/j-c-y/p/11512658.html