- 2024-09-07服务端
//mysocket.h#ifndef__MYSOCKET_H__#define__MYSOCKET_H__//头文件保护#include<bits/stdc++.h>#include<winsock.h>#pragmacomment(lib,"ws2_32.lib")usingnamespacestd;WSADATAwsdata;voidstartup(){//异步启动if(WSAStart
- 2024-08-09select多路复用(tcp通信)
文章目录项目名称项目结构项目名称io_demo1项目结构$tree.├──build├──CMakeLists.txt├──debug.gdb├──include│├──mysocket.h│├──tcp_client.h│└──tcp_server.h├──sources│└──server.cpp└──sr
- 2024-06-08发信息(客户)
//客户端#include"mysocket.h"//头文件usingnamespacestd;intmain(){cout<<"-----------------客户端----------------\n";startup();//启动//检测版本号if(LOBYTE(wsdata.wVersion)!=2||HIBYTE(wsdata.w
- 2024-06-08网络通信
服务端//服务端(以C++作范例)#include"mysocket.h"//导入头文件:由于mysock头文件本身就有其它文件,这里无需导入 usingnamespacestd;SOCKETs_accept;intmain(){ cout<<"---------------------------服务端---------------------------\n"; cout<<"正在
- 2024-06-08mysocke.h
//mysocket.h#ifndef__MYSOCKET_H__#define__MYSOCKET_H__//头文件保护#include<bits/stdc++.h>#include<winsock.h>#pragmacomment(lib,"ws2_32.lib")usingnamespacestd;WSADATAwsdata;voidstartup(){//异步启动if(WSAStart