请转载者,尊重作者(xiaobin)的劳动成果!在第一个实例我们已经编写了客户端程序,本篇编写他的姊妹篇---服务器端程序。基本上,服务器端程序既是客户端程序的“反”程序!1. 建立socket通信2. 初始化servaddr 2.1 置0 2.2 设置协议族 2.3 设置端口 2.4 设置ip地址为本机所有地址/任意地址3. 绑定socket的端口4. 监听socket以上2.4, 3, 4是为客户端的connect做准备的。循环执行:5. 接受连接6. 发送数据7. 关闭连接 第二个运行实例! daytimetcpsrv.c #include "./lib/unp.h" Read More
posted @ 2013-04-18 14:33
javawebsoa
Views(176)
Comments(0)
Diggs(0)
和HDU1043一样的题目,这次用DBFS实现。感觉写的还是不错的,中间一些细节错误了很多次。具体见代码。#include <iostream>#include <cstdio>#include <algorithm>#include <string>#include <cmath>#include <cstring>#include <queue>#include <set>#include <vector>#include <stack>#include <map& Read More
posted @ 2013-04-18 14:28
javawebsoa
Views(157)
Comments(0)
Diggs(0)