linux下串口转TCP/IP的终端服务器实现
2011-05-13 11:12
441 查看
串口与网络IP、端口号完成映射的脚本。希望对大家有帮助
[root@localhost bash_doc]# cat ./ttyusb.sh
#!/bin/bash
TCP_PORT=5021
SERIAL_PORT=/dev/ttyUSB0
BAUDRATE=9600
while (true)
do
stty -F $SERIAL_PORT $BAUDRATE
stty -F $SERIAL_PORT line 0
stty -F $SERIAL_PORT eof ^A
stty -F $SERIAL_PORT min 1
stty -F $SERIAL_PORT time 0
stty -F $SERIAL_PORT -brkint
stty -F $SERIAL_PORT -icrnl
stty -F $SERIAL_PORT ixoff
stty -F $SERIAL_PORT -imaxbel
stty -F $SERIAL_PORT -opost
stty -F $SERIAL_PORT -onlcr
stty -F $SERIAL_PORT -isig
stty -F $SERIAL_PORT -icanon
stty -F $SERIAL_PORT -iexten
stty -F $SERIAL_PORT -echo
stty -F $SERIAL_PORT -echoe
stty -F $SERIAL_PORT -echok
stty -F $SERIAL_PORT -echoctl
stty -F $SERIAL_PORT -echoke
nc -l 192.168.1.33 $TCP_PORT < $SERIAL_PORT > $SERIAL_PORT
done
本文出自 “奋斗成就卓越” 博客,请务必保留此出处http://tiger506.blog.51cto.com/318536/564710
[root@localhost bash_doc]# cat ./ttyusb.sh
#!/bin/bash
TCP_PORT=5021
SERIAL_PORT=/dev/ttyUSB0
BAUDRATE=9600
while (true)
do
stty -F $SERIAL_PORT $BAUDRATE
stty -F $SERIAL_PORT line 0
stty -F $SERIAL_PORT eof ^A
stty -F $SERIAL_PORT min 1
stty -F $SERIAL_PORT time 0
stty -F $SERIAL_PORT -brkint
stty -F $SERIAL_PORT -icrnl
stty -F $SERIAL_PORT ixoff
stty -F $SERIAL_PORT -imaxbel
stty -F $SERIAL_PORT -opost
stty -F $SERIAL_PORT -onlcr
stty -F $SERIAL_PORT -isig
stty -F $SERIAL_PORT -icanon
stty -F $SERIAL_PORT -iexten
stty -F $SERIAL_PORT -echo
stty -F $SERIAL_PORT -echoe
stty -F $SERIAL_PORT -echok
stty -F $SERIAL_PORT -echoctl
stty -F $SERIAL_PORT -echoke
nc -l 192.168.1.33 $TCP_PORT < $SERIAL_PORT > $SERIAL_PORT
done
本文出自 “奋斗成就卓越” 博客,请务必保留此出处http://tiger506.blog.51cto.com/318536/564710
相关文章推荐
- TCP/IP原理、基础以及在Linux上的实现 (4)
- linux下使用usb总线实现类似于tcp/ip的server/client通信
- Linux下的TCP/IP编程----多播和广播的实现
- 005.TCP--拼接TCP头部IP头部,实现TCP三次握手的第一步(Linux,原始套接字)
- TCP/IP原理、基础以及在Linux上的实现
- linux下TCP/IP实现简单聊天程序
- linux TCP/IP内核实现
- [转] TCP/IP原理、基础以及在Linux上的实现
- TCP/IP原理、基础以及在Linux上的实现 (5)
- 实现基于TCP/IP的多串口转换网关
- linux之TCP/IP创建线程实现简单聊天(2)
- Linux TCP/IP 协议栈之 Socket 的实现分析(一)
- TCP/IP原理、基础以及在Linux上的实现
- linux网络编程练习---聊天室(TCP/IP实现)
- TCP/IP原理、基础以及在Linux上的实现(转)
- TCP/IP原理、基础以及在Linux上的实现
- TCP/IP原理、基础以及在Linux上的实现 (1)
- Linux TCP/IP socket 实现
- linux下用TCP/IP编程实现远程文件传输
- linux下TCP/IP实现简单聊天程序