1、 服务端
#include <stdio.h>
#include <winsock2.h>
#include <Windows.h>
//加载驱动 库
#pragma comment(lib , "ws2_32.lib")
//线程函数体
DWORD WINAPI ThreadFun(LPVOID lpParam)
{
SOCKET sock = *((SOCKET*)lpParam);
char recvBuf[1000] = "";
char sendBuf[1000] = "";
//printf("%s \n", sock);
while (true)
{
//接收客户端信息
int length = recv(sock, recvBuf, 1000, 0);
if (length > 0)
{
printf("客户端:%s\n", recvBuf);
}
else
{
printf("接收失败")<