DWORD SockProcess::ConnectScoket()
{
//create a socket;
WSADATA wsaData;
struct sockaddr_in ServerAddr;
DWORD dwThreadId;
WSAStartup(MAKEWORD(2,2),&wsaData);
ListeningSocket = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
ServerAddr.sin_family = AF_INET;
ServerAddr.sin_port = htons(nPort);
ServerAddr.sin_addr.s_addr = htonl(INADDR_ANY);
// bind a socket;
bind(ListeningSocket,(SOCKADDR *)&ServerAddr,sizeof(ServerAddr));
listen(ListeningSocket,5);
hGlobalWriteEvent = CreateEvent(NULL,TRUE,TRUE,"Close Thread");
CreateThread(NULL,0,ReceiveThread,(LPVOID)ListeningSocket,0,&dwThreadId);//启用一个线程来监听端口;
return 0;
}
//下面是实现的函数;
DWORD SockProcess::ReceiveThread(LPVOID lpPrarm)
{
...
}
//编译后出现线面的错误提示;
D:\work\myproject\BMP(2006-06-29)\test\DisplayBMP\SockProcess.cpp(61) : error C2664: 'CreateThread' : cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned long (__stdcall *)(void *)'
None of the functions with this name in scope match the target type
解决办法:
SockProcess.h头文件中
static DWORD WINAPI ReceiveThread(LPVOID lpPrarm);
posted on 2006-09-15 09:35
游子 阅读(1312)
评论(0) 编辑 收藏 引用 所属分类:
软件