摘要: 网络模型: OSI七层模型: 应用层:典型协议:HTTP,FTP,DNS,DHCP 表示层:进行格式装换 会话层:定义连接的方式,例如全双工通信,半双工通信,单工通信 传输层:协议:TCP,UDP 网络层:设备:路由器,典型协议IP,ICMP,路由协议:OSPF,BGP,RIP 数据链路层:设备:交 阅读全文
posted @ 2017-10-13 20:05 菜鸟也有高飞的时候 阅读(214) 评论(0) 推荐(0) 编辑
摘要: // 重叠IO网络模式.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include #include using namespace std; #pragma comment (lib,"ws2_32.lib") #define PORT 6000 #define MSGSIZE 1024 typedef struct {... 阅读全文
posted @ 2017-07-07 11:10 菜鸟也有高飞的时候 阅读(367) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h" #include #include #include using namespace std; #pragma comment (lib,"ws2_32.lib") #define PORT 6000 SOCKET ArrSocket[1024] = { 0 }; WSAEVENT ArrEvent[1024] = { 0 }; DWORD dwTot... 阅读全文
posted @ 2017-07-06 15:52 菜鸟也有高飞的时候 阅读(605) 评论(0) 推荐(0) 编辑
摘要: fd_set set; FD_ZERO(&set); /*将set清零使集合中不含任何fd*/ FD_SET(fd, &set); /*将fd加入set集合*/ FD_CLR(fd, &set); /*将fd从set集合中清除*/ FD_ISSET(fd, &set); /*在调用select()函 阅读全文
posted @ 2017-07-05 20:41 菜鸟也有高飞的时候 阅读(614) 评论(0) 推荐(0) 编辑
摘要: //Server #include "stdafx.h" #include #include #include using namespace std; #pragma comment (lib,"ws2_32.lib") #define PORT 6000 //UDP Server int main() { //初始化网络环境 WSADATA wsa; if (WS... 阅读全文
posted @ 2017-07-04 20:52 菜鸟也有高飞的时候 阅读(1929) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h" #include #include #include using namespace std; #pragma comment (lib,"ws2_32.lib") //Client int main() { WSADATA wsa; if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0) { ... 阅读全文
posted @ 2017-07-04 16:15 菜鸟也有高飞的时候 阅读(278) 评论(0) 推荐(0) 编辑
摘要: //Sever #include "stdafx.h" #include #include #include using namespace std; #pragma comment (lib,"ws2_32.lib") #define PORT 6000 DWORD WINAPI clientProc(LPVOID lparam) { //为客户端服务 SOCKET soc... 阅读全文
posted @ 2017-07-04 10:57 菜鸟也有高飞的时候 阅读(224) 评论(0) 推荐(0) 编辑
摘要: string UnicodeToANSI(const wstring& str) { char *pStr; int iwstrLen = WideCharToMultiByte(CP_ACP, 0, str.c_str(), -1, 0, 0, 0, 0); cout << "iwstrlen=" << iwstrLen << endl; pStr = new ... 阅读全文
posted @ 2017-06-30 20:05 菜鸟也有高飞的时候 阅读(1395) 评论(0) 推荐(0) 编辑
摘要: 进程的创建: WinExec函数: UINT Win Exec(LPCSTR lpCmdLine, UINT uCmdShow); lpCmdLine:指向一个空结束的字符串,串中包含将要执行的应用程序的命令行(文件名加上可选参数)。 uCmdShow:定义Windows应用程序的窗口如何显示,并为 阅读全文
posted @ 2017-04-21 13:09 菜鸟也有高飞的时候 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 设备环境:又叫做设备上下文,设备DC,DC,主要是程序用来画图的, 利用GetDC(HWND类型)可以获得客户区的DC 利用GetWindowsDC(HWND类型)可以获得窗口的DC 当获取一个DC的时候用完之后需要释放这个DC,ReleaseDC(HWND类型, 该DC变量); 当我们不需要用系统 阅读全文
posted @ 2017-03-25 13:50 菜鸟也有高飞的时候 阅读(154) 评论(0) 推荐(0) 编辑