|
|
|
[求助]完成端口的问题,请高手指点啊,谢谢
当我没改。。 |
|
[求助]完成端口的问题,请高手指点啊,谢谢
我修正的部分代码 DWORD WINAPI ServerWorkerThread(LPVOID CompletionPortID) { HANDLE CompletionPort = (HANDLE)CompletionPortID; DWORD BytesTransferred; LPPER_HANDLE_DATA pPerHandleData; LPPER_IO_OPERATION_DATA pPerIoOperationData; DWORD flags; DWORD RecvBytes; DWORD SendBytes; while (TRUE) { bool Ret = GetQueuedCompletionStatus(CompletionPort, &BytesTransferred, (LPDWORD)&pPerHandleData, (LPOVERLAPPED *)&pPerIoOperationData, INFINITE); //退出信号到达,退出线程 if (BytesTransferred==-1 && pPerIoOperationData==NULL) { return 1L; } //客户机已经断开连接或者连接出现错误 if ( BytesTransferred==0 && (pPerIoOperationData->_type == RECV_POSTED || pPerIoOperationData->_type == SEND_POSTED) ) { // 从Vector中删除客户端连接SOCKET EnterCriticalSection(&cs); for (it=SocketVector.begin(); it<SocketVector.end(); it++) { if ( (*it)._socket == pPerHandleData->_socket ) { SocketVector.erase(it); break; } } LeaveCriticalSection(&cs); // 关闭套接口 closesocket(pPerHandleData->_socket); GlobalFree(pPerHandleData); GlobalFree(pPerIoOperationData); continue; } switch(pPerIoOperationData->_type) { case RECV_POSTED: { //申请新的内存空间 PER_IO_OPERATION_DATA *SendIOData = (PER_IO_OPERATION_DATA *)GlobalAlloc(GPTR,sizeof(PER_IO_OPERATION_DATA)); SendIOData->_type = SEND_POSTED; CopyMemory(SendIOData->buff,pPerIoOperationData->buff,BytesTransferred); SendIOData->_wsabuf.buf = SendIOData->buff; SendIOData->_wsabuf.len = BytesTransferred; WSASend(pPerHandleData->_socket, &SendIOData->_wsabuf, 1, &SendBytes, 0, &SendIOData->_overlapped, NULL); ////////////////////////////////////////////////////////////////////////////////// //重置重叠结构,为再次接收数据做准备 ZeroMemory(&(pPerIoOperationData->_overlapped), sizeof(OVERLAPPED)); pPerIoOperationData->_wsabuf.buf = pPerIoOperationData->buff; pPerIoOperationData->_wsabuf.len = BUFFER_SIZE; pPerIoOperationData->_type = RECV_POSTED; flags = 0; //提交另一个Recv请求 WSARecv(pPerHandleData->_socket, &(pPerIoOperationData->_wsabuf), 1, &RecvBytes, &flags, &(pPerIoOperationData->_overlapped), NULL); } break; case SEND_POSTED: { memset(pPerIoOperationData, 0, sizeof(PER_IO_OPERATION_DATA)); GlobalFree(pPerIoOperationData); BytesTransferred = 0; } break; } } return 0; } |
|
杀死自己的进程再重新启动自己(delphi语句)
Delphi的代码总是看的我很头疼。。。 |
|
[原创]发一个键盘记录器--附源码
程序结构简单明了。。赞~ |
|
[救助]关于WriteFile写文件问题........
lpBuffer db '床前明月光,",0dh,0ah,"疑是地上霜.",0dh,0ah,"举头望明月,",0dh,0ah,"低头思故乡.',0 |
|
|
|
|
|
|
|
[求助]关于VC编写的DLL的导出函数名称修改
在函数名前加extern "C" __declspec (dllexport) |
|
|
|
|
|
[求助]请问如何得到win32系统服务的列表
有专门的API |
|
[原创]MX发信 核心源码
最初由 非安全 发布 VC6吧? 升级吧。。。。。。。。。。 |
|
|
|
[原创]MX发信 核心源码
QPDecode这个是解码函数,这个例子中没有使用,一般在读取邮件信息的时候才会用到。。。。。。 |
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值