#include "stdafx.h"
#include <winsock2.h>
#include <iostream>
#include <windows.h>
using namespace std;
#pragma comment(lib,"ws2_32.lib")
DWORD WINAPI connect(LPVOID lpParamter)
{
WSADATA wsaData; //指向WinSocket信息结构的指针
SOCKADDR_IN sin, saClient; //设置两个地址,sin用来绑定
//saClient用来从广播地址接收消息
unsigned char buf[60]; //定义接收缓冲区
int nSize, nbSize;
int iAddrLen = sizeof(saClient);
if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) //进行WinSocket的初始化
{
printf("Can't initiates windows socket!Program stop.\n");//初始化失败返回-1
return -1;
}
sockListener