《 UNIX网络编程》源码的使用

Unix网络编程第三版源码编译 本文用的Unix网络编程源码是第三版,不同版本的源码可能会有不同的错误,还有不同的操作系统也会有不同的错误,本文基于fedora 20 64位操作系统,不过一般都不是满大的问题,多改两下就好了。 配置: cd Unix-Network-Programming/ ./configure      //若无法执行,可以用chmod更改权限 主要的工作是检查系统是否有源码编译 阅读详情

关于

最近在学网络编程,借了一本书《UNIX网络编程 第一卷:套接口API (第3版)》 STEVENS大神著的!

学习编程这东西,看代码,改代码,运行代码这样才能学到实际东西!本书说在www.unpbook.com可以获取源码,不过打不开!所以google

unpv13e.tar.gz

并在网络上找到了:源码:http://code.google.com/p/stid/downloads/detail?name=unpv13e.tar.gz&can=2&q=

现在就是使用的问题了!

关于在windows下的问题

既然是unix网络编程,直接在windows下运行当然是行不通的!(问:那还学这个干嘛!?? 你说呢,我们学的是思想和方法,window网络编程其实差异不大)

不过在windows下装个UNIX模拟器cygwin貌似是一个不错的选择!也有人用这个模拟器搭建UNIX网络编程平台,不过对初学者有一定难度!(cygwin是个好东西呀!)

关于在Linux 下的使用问题

Linux也是UNIX,当然没问题!现在说明如何使用书本源码___unpv13e.tar.gz__的_问题。

首先,解压源码,这里是解压到当前目录:acer@ubuntu:~$ tar -xvf unpv13e.tar.gz

其后,建议去阅读解压后目录unpv13e下的README文档!

README文档内容如下:标记红色的部分来处理即可!

_QUICK AND DIRTY
===============

Execute the following from the src/ directory:

./configure # try to figure out all implementation differences

cd lib # build the basic library that all programs need
make # use “gmake” everywhere on BSD/OS systems

cd …/libfree # continue building the basic library
make

cd …/libroute # only if your system supports 4.4BSD style routing sockets
make # only if your system supports 4.4BSD style routing sockets

cd …/libxti # only if your system supports XTI
make # only if your system supports XTI

cd …/intro # build and test a basic client program
make daytimetcpcli
./daytimetcpcli 127.0.0.1

If all that works, you’re all set to start compiling individual programs.

Notice that all the source code assumes tabs every 4 columns, not 8.

MORE DETAILS
============

5. If you need to make any changes to the “unp.h” header, notice that it
is a hard link in each directory, so you only need to change it once.

6. Go into the “lib/” directory and type “make”. This builds the library
“libunp.a” that is required by almost all of the programs. There may
be compiler warnings (see NOTES below). This step is where you’ll find
all of your system’s dependencies, and you must just update your cf/
files from step 1, rerun “config” and do this step again.

6. Go into the “libfree/” directory and type “make”. This adds to the
“libunp.a” library. The files in this directory do not #include
the “unp.h” header, as people may want to use these functions
independent of the book’s examples.

8. Once the library is made from steps 5 and 6, you can then go into any
of the source code directories and make whatever program you are
interested in. Note that the horizontal rules at the beginning and
end of each program listing in the book contain the directory name and
filename.

BEWARE: Not all programs in each directory will compile on all systems
(e.g., the file src/advio/recvfromflags.c will not compile unless your
system supports the IP_RECVDSTADDR socket option). Also, not all files
in each directory are included in the book. Beware of any files with
“test” in the filename: they are probably a quick test program that I
wrote to check something, and may or may not work.

NOTES
-----

- Many systems do not have correct function prototypes for the socket
functions, and this can cause many warnings during compilation.
For example, Solaris 2.5 omits the “const” from the 2nd argument
to connect(). Lots of systems use “int” for the length of socket
address structures, while Posix.1g specifies “size_t”. Lots of
systems still have the pointer argument to [sg]etsockopt() as a
“char *” instead of a “void *”, and this also causes warnings.

- SunOS 4.1.x: If you are using Sun’s acc compiler, you need to run
the configure program as

CC=acc CFLAGS=-w CPPFLAGS=-w ./configure

Failure to do this results in numerous system headers (<sys/sockio.h>)
not being found during configuration, causing compile errors later.

- If your system supports IPv6 and you want to run the examples in the
book using hostnames, you must install the latest BIND release. You
can get it from ftp://ftp.vix.com/pub/bind/release. All you need from
this release is a resolver library that you should then add to the
LDLIBS and LDLIBS_THREADS lines.

- IPv6 support is still in its infancy. There may be differences
between the IPv6 sockets API specifications and what the vendor
provides. This may require hand tweaking, but should get better
over time.

- If your system supports an older draft of the Posix pthreads standard,
but configure detects the support of pthreads, you will have to disable
this by hand. Digital Unix V3.2C has this problem, for example, as it
supports draft 4, not the final draft.

To fix this, remove wrappthread.o from LIB_OBJS in “Make.defines” and
don’t try to build and run any of the threads programs.

COMMON DIFFERENCES
------------------

These are the common differences that I see in various headers that are
not “yet” at the level of Posix.1g or X/Open XNS Issue 5.

- getsockopt() and setsockopt(): 5th argument is not correct type.

- t_bind(): second argument is missing “const”.

- t_connect(): second argument is missing “const”.

- t_open(): first argument is missing “const”.

- t_optmsmg(): second argument is missing “const”.

- If your <xti.h> defines the members of the t_opthdr{} as longs,
instead of t_uscalar_t, some of the printf formats of these value
might generate warnings from your compiler, since you are printing
a long without a corresponding long format specifier.
_

_注意:以后我们都用make编译源代码
_

最后运行:./daytimetcpcli 127.0.0.1_如下_

_acer@ubuntu:~/jwt/unpv13e/intro$ ./daytimetcpcli 127.0.0.1
connect error: Connection refused
_

发现报错:connect error: Connection refused

这种情况说明服务器没有启动daytime服务!那Ubuntu如何启动,daytime服务呢?

Ubuntu启动daytime服务

1. sudo apt-get install xinetd

2. sudo vi /etc/xinetd.d/daytime, change disable = yes to no

3. sudo /etc/init.d/xinetd restart

在运行_./daytimetcpcli 127.0.0.1_

出现结果!!

Unix网络编程(卷二)源码编译报错解决 源码下载地点:http://www.kohala.com/start/unpv22e/unpv22e.html1、按照Readme操作,进入lib目录下make报错:gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS   -c -o daemon_inetd.o daemon_inetd.cIn file included from /usr/include/netinet/in.h:24,                 from /usr/i 阅读详情

相关推荐

UNIX网络编程实战源码详解

UNIX网络编程是计算机网络领域中的一项重要技能,它允许开发者利用UNIX系统提供的网络接口进行编程,实现数据的网络传输和进程间的通信。该领域的核心是套接字(Socket)编程,它提供了一种在不同操作系统和平台间交换数据的通用方式。本章将概述UNIX网络编程的基础,包括其发展背景、核心概念以及在网络时代中的重要性,为深入理解后续章节打下坚实的基础。套接口(Socket)是计算机网络通信的基本构件,其功能类似于现实世界中的电话插孔,它是应用程序进行网络通信的一种抽象。

weixin_35706067的博客 1098

unix 网络编程 头件下载安装

《UNIX网络编程 第一卷:套接口API (第3版)》 unpv13e

t1234xy4的专栏 503

UNIX源代码分析+源码

UNIX源代码分析+源码

Unix V6内核源码的理解(一)

一、关于malloc和mfree 首先介绍的是存储资源 编程中最常用的是分配和释放内存资源,这两个过程实际两类存储资源的分配和释放: 主存和盘交换区 下面展示源码部分: #define CMAPSIZ 100 #define SMAPSIZ 100 int coremap[CMAPSIZ]; //主存区分配资源图 int swapmap[SMAPSIZ];

sadoshi的专栏 6372

UNIX环境高级编程源码

UNIX环境高级编程源码,可学习可参考可练习

UNIX网络编程源码unpv13e

配套编译和测试参考:https://editor.youkuaiyun.com/md/?articleId=125043113

《UNIX网络编程》源码编译

UNIX 网络编程源码编译、环境搭建 源码下载 http://www.unpbook.com README文件 下载好的源码包,解压,有README文件,根据文件说明,按照需求进行相关操作。 ./configure cd /lib make cd /libfree make 在进入libfree文件夹make时可能会出错,提示 inet_ntop.c:60:9: error: argumen...

肥宅不死的博客 419

保姆级教程:在阿里云ECS上用Docker一键部署EMQX MQTT服务器(Ubuntu 20.04)

本文提供在阿里云ECS上使用Docker一键部署EMQX MQTT服务器的详细教程,涵盖从实例创建、Docker环境配置到EMQX部署与优化的全流程。适合物联网开发者快速搭建高效、安全的MQTT消息服务器,适用于智能家居、工业物联网等场景。

weixin_28739079的博客 308

UNIX网络编程源码的使用

关于 最近在学网络编程,借了一本书《UNIX网络编程 第一卷:套接口API (第3版)》 STEVENS大神著的! 学习编程这东西,看代码,改代码,运行代码这样才能学到实际东西!本书说在www.unpbook.com可以获取源码,不过打不开!所以google

Our little drops... 1868

禅道18.3版本二开避坑指南:手把手教你扩展自定义报表功能

本文详细介绍了禅道18.3版本的二次开发实践,重点讲解如何扩展自定义报表功能。通过zentaoPHP框架的深度定制,从开发环境搭建到核心数据模型扩展,再到可视化配置和性能优化,手把手教你构建多维报表分析系统,满足企业级项目管理需求。

day7的博客 370

Mid-360与FAST-LIO2实战:从点云采集到高精度建图全流程解析

本文详细解析了使用Livox Mid-360激光雷达与FAST-LIO2算法实现高精度实时建图的全流程。内容涵盖硬件准备、软件环境搭建、算法部署配置、数据采集实战,并重点探讨了多楼层场景下的参数调优与误差抑制策略,为机器人及无人机三维感知应用提供了实用指南。

prometheus9mon的博客 414

《UNIX网络编程》源码的使用

UNIX网络编程 第一卷:套接口API (第3版) 源码下载:http://www.ituring.com.cn/book/164?q=unix%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B 在Linux 下的使用 Linux也是UNIX,当然没问题!现在说明如何使用书本源码unpv13e.tar.gz的问题。 首先,解压源码 其

zyseap的专栏 1520

从拆解到调试:用CS5523改造旧款车载显示屏的完整记录(MIPI转eDP方案)

本文详细记录了使用CS5523芯片将旧款车载显示屏从MIPI接口改造为eDP驱动的完整过程。通过对比LT8911等芯片,选择CS5523实现低功耗、高兼容性的显示升级,涵盖硬件改造、固件配置及调试技巧,最终成功提升显示效果200%。

web99的专栏 344

UNIX网络编程之一、如何运行书籍自带源码

前言 最近在学网络编程,于是下了一本《UNIX网络编程第一卷:套接口API (第3版)》,书中的内容哦高写得很不错,但是毕竟是学代码,不试着调试调试怎么玩呢?但是书上列出的代码根本不好运行,于是百度以后,找到了这个地址:源码下载 拿到源码以后发现看不懂,不过幸好有README; 现在就是使用的问题了,我用的操作系统是Linux Mint17 (64bit),按理说是没有什么问题的;下面具体讲

Owen遇上Phyllis 640

解决com.kingbase8.util.KSQLException: This _connection has been closed.

一个消息管理系统,系统采用kingbase8数据库,数据库采用单体模式,后台应用也采用springboot单体模式。系统正式上线后,出现几个JDBC响应的异常信息: com.kingbase8.util.KSQLException: An I/O error occurred while sending to the backend. java.net.SocketTimeoutException: Read timed out.

qq_38127559的博客 2757

别再死磕DH参数了!用MATLAB Robotics Toolbox + SOLIDWORKS搞定六轴机械臂仿真(附避坑指南)

本文详细介绍了如何利用MATLAB Robotics Toolbox和SOLIDWORKS进行六轴机械臂仿真,避免常见的DH参数错误和模型导出问题。通过实战指南和避坑技巧,帮助工程师实现从三维建模到运动学仿真的无缝衔接,提升仿真效率和准确性。

weixin_27066963的博客 394

如何运行《unix网络编程》的源码

UNIX网络编程如何运行源码

Lane1nPocket的博客 250

[ 人力资源面试篇 ] HR 面试题分析详解大集合,看完直怼面试官(二)

那么在这个系列的文章中,我们聊到 HR 面谈什么?并且总结了五十个常见的人力资源面试题,在这里分享给大家。

qq_51577576的博客 1380

UNIX网络编程卷2 源码编译篇

1 tar -xzfv unpv22e.tar.gz 2 cd unpv22e 3 ./configure 4 cd lib 5 make   make编译失败,因为需要对两个文件修改,unpv22e/config.h和unpv22e/wrapunix.c。 vi config.h /*注释掉这三行*/ // #define uint8_t unsigned char /* <sys/types.h> */ // #define uint16_t unsigned sho..

1 475

【手把手教学】YOLOv13的Dilated Reparam Block (DRB) 实现细节与优化技巧

DRB(Dilated Reparam Block)是一种创新的卷积神经网络模块,通过多分支膨胀卷积和结构重参数化技术显著提升模型性能。训练阶段使用不同膨胀率和卷积核大小的并行分支增强特征提取能力,推理阶段则将这些分支融合为单一高效的大核卷积。该方法成功解决了大核卷积的计算复杂度和训练困难等问题,在保持推理效率的同时,使模型准确率提升8.56%,mAP暴涨12.33%。DRB的核心在于训练时复杂、推理时简单的设计哲学,以及膨胀卷积的多尺度特征提取能力,为CNN性能优化提供了新的思路。

FJN110的博客 556

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

如何使用unix网络编程第三版的源码

unix网络编程书中所有代码都基于它提供的头文件和库。所以学习时要用书中的代码做练习就必须配置好他需要的环境。     首先到http://ishare.iask.sina.com.cn/f/13238521.html?sudaref=blog.youkuaiyun.com&retcode=0下载源码包    第一步:在终端中进入upnv13e目录,然后执行代码: ./configure

My Blog 906

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

《unix网络编程》中源码使用方法

<unix网络编程>这本书中的unpv13e源码包使用,使用源码中写好的一些头文件

一根会发生的木头的专栏 1001

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

unix网络编程(卷一)--安装源码

从今天开始学习unix网络编程,

tangdexi112的专栏 1442
上一篇: windows下docker 挂载本地路径
下一篇: 【久远银海java面试题目面试经验】-看准网
普通网友
博客等级 码龄5年 3万+粉丝 466原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值