您的位置:首页 > 理论基础 > 计算机网络

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: