Jump to content

Internal IP redirect to public IP (Linux)


Recommended Posts

  • 2 weeks later...

desc_client.cpp in void CLIENT_DESC::SetPhase(int iPhase) edit

				if (!bSentBoot)
				{
					bSentBoot = true;
					TPacketGDBoot p;
					p.dwItemIDRange[0] = 0;
					p.dwItemIDRange[1] = 0;
					memcpy(p.szIP, g_szPublicIP, 16); // set you external ip instead g_szPublicIP 
					DBPacket(HEADER_GD_BOOT, 0, &p, sizeof(p));
				}

or you can do it in client side at NetAddress.cpp

void CNetworkAddress::GetIP(char* szIP, int len)
{
	BYTE IPs[4];
	*((DWORD*)IPs)=m_sockAddrIn.sin_addr.s_addr;

	_snprintf(szIP, len, "%d.%d.%d.%d", IPs[0], IPs[1], IPs[2], IPs[3]); // replace with you external server ip
}

 

  • Love 1
Link to comment
Share on other sites

  • Premium
La 20.08.2018 la 0:15, IceShiva a spus:

desc_client.cpp in void CLIENT_DESC::SetPhase(int iPhase) edit


				if (!bSentBoot)
				{
					bSentBoot = true;
					TPacketGDBoot p;
					p.dwItemIDRange[0] = 0;
					p.dwItemIDRange[1] = 0;
					memcpy(p.szIP, g_szPublicIP, 16); // set you external ip instead g_szPublicIP 
					DBPacket(HEADER_GD_BOOT, 0, &p, sizeof(p));
				}

or you can do it in client side at NetAddress.cpp


void CNetworkAddress::GetIP(char* szIP, int len)
{
	BYTE IPs[4];
	*((DWORD*)IPs)=m_sockAddrIn.sin_addr.s_addr;

	_snprintf(szIP, len, "%d.%d.%d.%d", IPs[0], IPs[1], IPs[2], IPs[3]); // replace with you external server ip
}

 

Thank you very much but in this way doesn't work because cannot bind on this IP.

Link to comment
Share on other sites

  • 3 weeks later...
  • 7 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.