void DataSendRank(char* pMsg, int size)
{
    if ( IsDevilSquareEventConnected == FALSE )
    {
        wsRServerCli.Close();
        wsRServerCli.CreateSocket(ghWnd);

        if ( GMRankingServerConnect(RankingServerIP, WM_GM_RANKING_CLIENT_MSG_PROC) == FALSE )
        {
            IsDevilSquareEventConnected = FALSE;
//			LogAddTD("Can not connect Ranking Server");

            return;
        }

        IsDevilSquareEventConnected = TRUE;
    }

    if ( IsDevilSquareEventConnected != FALSE )
    {
        wsRServerCli.DataSend(pMsg, size);
    }
}
Esempio n. 2
0
void LinksChecker()
{
	BYTE LinkDown=0;
	
	if(cDBSMng.wsCDBS[0].GetSocket() == INVALID_SOCKET)
	{
		linkLog.LogAddTD("[OFFLINE] DataServer 1");
		LinkDown++;
	}

	if(cDBSMng.wsCDBS[1].GetSocket() == INVALID_SOCKET)
	{
		linkLog.LogAddTD("[OFFLINE] DataServer 2");
		LinkDown++;
	}

	if(wsJServerCli.GetSocket() == INVALID_SOCKET)
	{
		for ( int n=OBJ_STARTUSERINDEX; n< OBJMAX; n++)
		{
			if ( gObj[n].Connected > PLAYER_EMPTY )
			{
				if ( gObj[n].Type == OBJ_USER )
				{
					CloseClient(n);
				}
			}
		}
		linkLog.LogAddTD("[OFFLINE] JoinServer");
		wsJServerCli.Close();
		wsJServerCli.CreateSocket(ghWnd);
		GMJoinServerConnect(JoinServerIp, WM_GM_JOIN_CLIENT_MSG_PROC);
		LinkDown++;
	}

	if(wsExDbCli.GetSocket() == INVALID_SOCKET)
	{
		linkLog.LogAddTD("[OFFLINE] ExDB");
	}

	if(ReadConfig.SCFPSON == 1)
	{
		if ( wsSCFPSCli.GetSocket()  == INVALID_SOCKET)
		{
			linkLog.LogAddTD("[OFFLINE] PostServer");
		}
	}

	if(wsExServerCli.GetSocket() == INVALID_SOCKET)
	{
		linkLog.LogAddTD("[OFFLINE] Extra Server");
	}

	if(ReadConfig.SCFIOGSON == 1)
	{
		if ( wsIOGSServerCli.GetSocket()  == INVALID_SOCKET)
		{
			linkLog.LogAddTD("[OFFLINE] IOGS");
		}
	}

	if(ReadConfig.SCFESON == FALSE)
	{
		if(IsEventChipServerConnected == FALSE)
		{
			linkLog.LogAddTD("[OFFLINE] EventServer");
			if ((EventChipServerConnect!=0) && (IsEventChipServerConnected==0))
			{
				wsEvenChipServerCli.Close();
				wsEvenChipServerCli.CreateSocket(ghWnd);
				if (GMEventChipServerConnect(gEventChipServerIp, WM_GM_EVENTCHIP_CLIENT_MSG_PROC) == 0)
				{
					goto RSCheck;
				}
				IsEventChipServerConnected=1;
			}
		}
	}
RSCheck:
	if(ReadConfig.SCFRSON == FALSE)
	{
		if(IsDevilSquareEventConnected == FALSE)
		{
			linkLog.LogAddTD("[OFFLINE] RankingServer");
			
			if ((DevilSquareEventConnect==0) && (IsDevilSquareEventConnected==0))
			{
				wsRServerCli.Close();
				wsRServerCli.CreateSocket(ghWnd);
				if (GMRankingServerConnect(gDevilSquareEventServerIp, WM_GM_RANKING_CLIENT_MSG_PROC) == 0)
				{
					goto LastCheck;
				}
				IsDevilSquareEventConnected=1;
			}				
		}
	}
LastCheck:
	if(AutoClose == TRUE && LinkDown == 0)
	{
		AutoClose = FALSE;
		HWND pWnd = FindWindow(NULL, "Close");

		if(pWnd != NULL)
		{
			SendMessage(pWnd,WM_COMMAND,IDNO,0);
			//DestroyWindow(pWnd);
		}
	}
}