Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ThreadFuncForComm.cpp
Package: LegendOfMir2_Server020418.zip [view]
Upload User: szopptop
Upload Date: 2013-04-23
Package Size: 1047k
Code Size: 1k
Category:
Game Server Simulator
Development Platform:
Visual C++
- #include "stdafx.h"
- #define PACKET_KEEPALIVE "%--$"
- extern HWND g_hToolBar;
- extern HWND g_hStatusBar;
- extern SOCKET g_csock;
- extern SOCKADDR_IN g_caddr;
- void SendExToServer(char *pszPacket);
- BOOL jRegGetKey(LPCTSTR pSubKeyName, LPCTSTR pValueName, LPBYTE pValue);
- VOID WINAPI OnTimerProc(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
- {
- switch (idEvent)
- {
- case _ID_TIMER_KEEPALIVE:
- {
- if (g_csock != INVALID_SOCKET)
- {
- SendExToServer(PACKET_KEEPALIVE);
- SendMessage(g_hStatusBar, SB_SETTEXT, MAKEWORD(2, 0), (LPARAM)_TEXT("Check Activity"));
- }
- break;
- }
- case _ID_TIMER_CONNECTSERVER:
- {
- if (g_csock == INVALID_SOCKET)
- {
- DWORD dwIP = 0;
- int nPort = 0;
- InsertLogMsg(IDS_APPLY_RECONNECT);
- jRegGetKey(_SELGATE_SERVER_REGISTRY, _TEXT("RemoteIP"), (LPBYTE)&dwIP);
- if (!jRegGetKey(_SELGATE_SERVER_REGISTRY, _TEXT("RemotePort"), (LPBYTE)&nPort))
- nPort = 5000;
- ConnectToServer(g_csock, &g_caddr, _IDM_CLIENTSOCK_MSG, NULL, dwIP, nPort, FD_CONNECT|FD_READ|FD_CLOSE);
- }
- break;
- }
- }
- }