chat之学习笔记1

本文详细介绍了PPP协议如何通过串行接口实现P2P连接,并着重讲解了autopppd脚本的工作原理,包括错误码处理和PPP谈判过程。此外,还探讨了chat命令在拨号和连接过程中的作用,以及相关C语言特性在程序中的应用。
摘要由CSDN通过智能技术生成
1.ppp 通过串行实现P2P协议达到互联网连接。
  支持TCP/UDP
2.串口<->pppd之间进行数据交换
3.支持平台Linux & Solaris
4.ppp/scripts脚本用于建立连接基于PPP
5.[autopppd] Perl脚本
open(PIDFILE,">/var/run/autopppd.pid");
>>以写入的方式打开指定的文件
print(PIDFILE "$$");
close(PIDFILE);
>>将进程号写入文件,关闭文件
核心为执行pppd,然后分析脚本执行的结果,包括错误码、信号、coredump


my $code = {
  0 => { message=>"pppd detached",                              action=> 2 },
  1 => { message=>"fatal error",                                action=> 2 },
  2 => { message=>"options error",                              action=> 2 },
  3 => { message=>"not setuid-root error",                      action=> 2 },
  4 => { message=>"no kernel support for PPP",                  action=> 2 },
  5 => { message=>"SIGINT or SIGTERM or SIGHUP",                action=> 1 },
  6 => { message=>"Serial port locked",                         action=> 1 }, # should be 0
  7 => { message=>"Serial port open error",                     action=> 1 },
  8 => { message=>"Connect failed",                             action=> 1 },
  9 => { message=>"Could not execute pty command",              action=> 1 },
 10 => { message=>"PPP negotiation failed",                     action=> 1 },
 11 => { message=>"Peer failed to au
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
03-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值