Code
来源:互联网 发布:毕业电子相册软件 编辑:程序博客网 时间:2024/05/01 07:28
LRESULT KPortServer::Run()
{
bool bE = false;
WSADATA wsData;
#define BUF_LEN 20
char szMsgBuf[BUF_LEN + 1];
sockaddr_in addrClient;
SYSTEMTIME sysTime;
bool bResult = true;
WSAStartup(MAKEWORD(2, 2), &wsData);
KServer::Init();
KServer::ResetSocket();
fprintf(stdout, "Waitting for client:/n");
while (true)
{
SOCKET skClient = INVALID_SOCKET;
PROCESS_ERROR(INVALID_SOCKET != (skClient = StartAccepting()));
addrClient = GetClientAddress();
GetLocalTime(&sysTime);
sprintf(szMsgBuf, "%d/0", ntohs(addrClient.sin_port));
send(skClient, szMsgBuf, strlen(szMsgBuf), !MSG_DONTROUTE);
fprintf(stdout, "%d:%d:%d:%d/tClient %s %d connected!/n",
sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds,
inet_ntoa(addrClient.sin_addr), ntohs(addrClient.sin_port));
printf("%s:/tSocket closed!/n", ::GetSystemTimeAsString());
shutdown(skClient, SD_RECEIVE);
closesocket(skClient);
}
bE = true;
Exit0:
WSACleanup();
return bE;
#undef BUF_LEN
}
- code
- code
- code
- code
- Code
- code
- code
- Code
- Code
- CODE
- code
- code
- code
- code
- code
- code
- Code
- code
- xxx2xxx转换工具邪恶八进制收集整理上传专用主题(不断更新)https://forum.eviloctal.com/viewthread.php?tid=14426
- Lucene.Net
- 文档类型定义DTD
- NLucene
- Code
- Code
- vb使用open方法读写文件
- 对.NET中导出数据到EXCEL的几种方法探讨
- 士兵突击
- [随意音乐]Enigma-"Return To Innocence" 返璞归真,回归自我
- Websharp
- FileHelpers Library
- 随便写写
- About - Return to innocence