摘要: 摘自:http://www.cnblogs.com/jiayongzhi/archive/2011/05/09/2041655.html#include <iostream>#include <Windows.h>using namespace std;const int MAXMESSAGE = 1024;class CXMessageList{public: CXMessageList(void); ~CXMessageList(void){};public: MSG* GetTopMessage(); MSG* WaitForMessage(); int GetM 阅读全文
posted @ 2012-10-04 23:35 hailong 阅读(186) 评论(0) 推荐(0)
摘要: 造了线程用select IO模型:#include <winsock.h>#include <stdio.h>#define PORT 5010#define MSGSIZE 1024#pragma comment(lib, "ws2_32.lib")int g_iTotalConn = 0;SOCKET g_CliSocketArr[FD_SETSIZE];DWORD WINAPI WorkerThread(LPVOID lpParameter);int main(){ WSADATA wsaData; SOCKET sListen, sClien 阅读全文
posted @ 2012-10-04 13:13 hailong 阅读(250) 评论(0) 推荐(0)
摘要: 上班两个月了,因为不是计算机专业出身,曾经因为不知道windows不能计算微妙级以下而被同时开玩笑非计算机专业是可以理解的,谁让我没读过《计算机操作系统》呢;老大要求我读《effective C++》和UML,因此假期没回家,好好读书吧;侯大师翻译的书各个是精品,《effective C++》没天狂啃几篇,除了模板编程,其他章节走马观花地看完了,舒了口气,但自己掌握了多少呢,表示还木有深入测试;因为看到项目中反复涉及网络编程,而且在设计中各位老师利用了网络中的一些策略,令我很不解,果断买了本《unix网络编程》,发现TCP/IP简直太好玩了,现在读到第6章了;虽然我在win32下写代码,但原书 阅读全文
posted @ 2012-10-04 08:41 hailong 阅读(358) 评论(0) 推荐(0)
摘要: server:#include"WinSock2.h"#include "time.h"#include "stdio.h"#include <string>#include <iostream>#pragma comment(lib,"WS2_32")using namespace std;const int MaxLine = 1024;char lBuf[MaxLine];short gPort = 9877;struct Args{ long arg1; long arg2;};st 阅读全文
posted @ 2012-10-04 00:21 hailong 阅读(197) 评论(0) 推荐(0)