Ubuntu中网络编程的环境配置
2012-12-06 15:26
253 查看
《UNP》中源代码的编译和使用 (2010-10-16 21:13)转载
分类: 网络相关
最近看了下《UNIX网络编程》,就想把里面的源代码搞过来运行下。以前也搞过,不过老是忘记使用代码的步骤了,所以就记录下,防止每次还要弄半天。
从网上下载压缩包解压到自己设定的目录下面,我的是/home/**/myprogram/UNP/unpv13e/,里面有
./
├── aclocal.m4
├── advio
├── bcast
├── config.guess
├── config.h
├── config.h.in
├── config.log
├── config.status
├── config.sub
├── configure
├── configure.in
├── debug
├── DISCLAIMER
├── icmpd
├── inetd
├── install-sh
├── intro
├── ioctl
├── ipopts
├── key
├── lib
├── libfree
├── libgai
├── libroute
├── libunp.a(就是为了生成这个文件)
├── Make.defines
├── Make.defines.in
├── Makefile
├── Makefile.in
├── mcast
├── mysdr
├── names
├── nonblock
├── oob
├── ping
├── README
├── route
├── rtt
├── sctp
├── select
├── server
├── sigio
├── sock
├── sockopt
├── sparc64-unknown-freebsd5.1
├── ssntp
├── streams
├── tcpcliserv
├── test
├── threads
├── traceroute
├── udpcksum
├── udpcliserv
├── unixdomain
├── unpv13e
└── VERSION
这么多的东西,呵呵!!,当然我们不能忘记了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
其实需要执行的就是前三步,其实就是为了生成libunp.a。复制这个静态库到/usr/lib/和/usr/lib64/中,因为后来编译程序的话需要用到这个静态库。还得在环境变量中将这两个路径加上。
接下来的是头文件unp.h的问题,这个文件在这个解压缩目录的lib文件夹中。
因为里面所有的文件都包含了#include“unp.h”这一句话,为了方便可以有两种方法:
一:
1.将lib下面的unp.h复制到/usr/include文件夹下面,并保证环境变量中有/usr/include;
2. 因为unp.h中有#include "../config.h",所以得把解压缩目录下面的config.h复制到/usr/include中,并将unp.h中的#include "../config.h"改成 #include "config.h"。
3在unp.h中添加一行:
#define MAX_LINE 2048
二:
1.将Lib文件夹下面的unp.h移到unpv13e中,
2.参照上面的第二条;
3.参照上面的第三条;
4.以后在子文件夹里面编译程序,把#include"unp.h"改为#include"../unp.h"
做完上面,我们就可以编译单个程序了,比如intro/byteorder.c。
root@**-desktop:/home/**/myprogram/UNP/unpv13e/intro# gcc -W -o byteorder byteorder.c -lunp
root@**-desktop:/home/**/myprogram/UNP/unpv13e/intro# ./byteorder
i686-pc-linux-gnu: little-endian
呵呵,就这样!
分类: 网络相关
最近看了下《UNIX网络编程》,就想把里面的源代码搞过来运行下。以前也搞过,不过老是忘记使用代码的步骤了,所以就记录下,防止每次还要弄半天。
从网上下载压缩包解压到自己设定的目录下面,我的是/home/**/myprogram/UNP/unpv13e/,里面有
./
├── aclocal.m4
├── advio
├── bcast
├── config.guess
├── config.h
├── config.h.in
├── config.log
├── config.status
├── config.sub
├── configure
├── configure.in
├── debug
├── DISCLAIMER
├── icmpd
├── inetd
├── install-sh
├── intro
├── ioctl
├── ipopts
├── key
├── lib
├── libfree
├── libgai
├── libroute
├── libunp.a(就是为了生成这个文件)
├── Make.defines
├── Make.defines.in
├── Makefile
├── Makefile.in
├── mcast
├── mysdr
├── names
├── nonblock
├── oob
├── ping
├── README
├── route
├── rtt
├── sctp
├── select
├── server
├── sigio
├── sock
├── sockopt
├── sparc64-unknown-freebsd5.1
├── ssntp
├── streams
├── tcpcliserv
├── test
├── threads
├── traceroute
├── udpcksum
├── udpcliserv
├── unixdomain
├── unpv13e
└── VERSION
这么多的东西,呵呵!!,当然我们不能忘记了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
其实需要执行的就是前三步,其实就是为了生成libunp.a。复制这个静态库到/usr/lib/和/usr/lib64/中,因为后来编译程序的话需要用到这个静态库。还得在环境变量中将这两个路径加上。
接下来的是头文件unp.h的问题,这个文件在这个解压缩目录的lib文件夹中。
因为里面所有的文件都包含了#include“unp.h”这一句话,为了方便可以有两种方法:
一:
1.将lib下面的unp.h复制到/usr/include文件夹下面,并保证环境变量中有/usr/include;
2. 因为unp.h中有#include "../config.h",所以得把解压缩目录下面的config.h复制到/usr/include中,并将unp.h中的#include "../config.h"改成 #include "config.h"。
3在unp.h中添加一行:
#define MAX_LINE 2048
二:
1.将Lib文件夹下面的unp.h移到unpv13e中,
2.参照上面的第二条;
3.参照上面的第三条;
4.以后在子文件夹里面编译程序,把#include"unp.h"改为#include"../unp.h"
做完上面,我们就可以编译单个程序了,比如intro/byteorder.c。
root@**-desktop:/home/**/myprogram/UNP/unpv13e/intro# gcc -W -o byteorder byteorder.c -lunp
root@**-desktop:/home/**/myprogram/UNP/unpv13e/intro# ./byteorder
i686-pc-linux-gnu: little-endian
呵呵,就这样!
相关文章推荐
- Linux网络编程 2 - ubuntu 16.04 环境配置
- Ubuntu中网络编程的环境配置
- Winpcap网络编程三之环境配置,Eclipse配置Winpcap环境
- 在Ubuntu环境下为Qemu配置桥接网络
- UNIX 网络编程环境配置
- Ubuntu下配置Swift编程环境
- Ubuntu C/C++的编程环境简单配置安装
- Ubuntu环境下网络连接配置
- 重装Ubuntu配置编程环境LAMP,J2EE从0开始
- ubuntu 下网络环境配置及互ping通过
- Ubuntu 12.04 LTS 配置python数据挖掘编程环境与mySQL
- UBUNTU网络环境配置(VMWARE虚拟机)
- ubuntu下配置python2.7.13神经网络环境
- Ubuntu 16.04.1 Server 64bit 系统安装后的网络配置(Vmware Workstation 12.5 & Windows 10 X64 环境)
- ubuntu上联系Unix环境高级编程-apue.h的配置与安装
- Ubuntu系统安装、网络配置、lamp环境搭建
- 网络数据库编程实验一JDBC数据库编程环境配置
- ubuntu13.10配置java编程环境,jdk.eclipse.tomcat
- [个人]Ubuntu编程环境配置
- 机会网络平台haggle在Ubuntu下的运行环境配置过程遇到问题的解决方案