现在的位置: 首页 > 综合 > 正文

准备工作

2013年05月08日 ⁄ 综合 ⁄ 共 1109字 ⁄ 字号 评论关闭

1.下载(UNIX® Network Programming Volume 1)源码
2.阅读README
提醒:很多初学者跟我一样静不下心来读E文的README。可README对我们搭建程序环境至关重要,一定要克服这种心里障碍。

根据readme提示 进行下列操作
1.   ./configure # try to figure out all implementation differences
      # 会在根目录生成相应的 Makefile,Make.defines,config.h 等重要文件
2.   cd lib # build the basic library that all programs need
      make # use "gmake" everywhere on BSD/OS systems

3.   cd ../libfree # continue building the basic library
      make

4.   cd ../intro # build and test a basic client program
      make daytimetcpsrv
      sudo ./daytimetcpsrv #我的系统ubuntu并未打开端口13,可用sudo netstat -antup系统所打开的监听端口

5.   make daytimetcpcli #另开一终端
      sudo ./daytimetcpcli 127.0.0.1
      #返回结果:
     Sat Mar 17 14:12:40 2012

OK,准备工作已经完成。

MORE DETAILS
============
2. 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.

3. 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.

【上篇】
【下篇】

抱歉!评论已关闭.