/***********************
服务器
************************/
#include "stdafx.h"
#include <stdio.h>
#include <winsock2.h>
#include <malloc.h>
#include "my_typedef.h"
#pragma comment(lib,"ws2_32.lib")
#define L_MAX (255)
#define C_MAX (100)
DWORD WINAPI ThreadProc( /* 线程函数 */
LPVOID lpParam
);
HANDLE tThread_Client[C_MAX] = {NULL};
LNode *pHead;
int main(int argc, char* argv[])
{
//初始化 WSA
WORD sockVersion = MAKEWORD(2,2);
WSADATA wsaData;
if(WSAStartup(sockVersion, &wsaData)!=0)
{
return 0;
}
//创建套接字
SOCKET slisten = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if(slisten == INV ALID_SOCKET)
{
printf("socket error !");
return 0;
}
//绑定 IP 和端口
sockaddr_in sin;