[Src]->Server On A Dynamic Address

Codes submitted by developers and people of outpost. Come here to get codes for your client sources.
Post Reply
Aryes
Member
Posts: 114
Joined: Tue Aug 31, 2004 10:14 pm
Location: Brazil

Post by Aryes »

One of the things that is a pain in the ass about having a server, is when your ip changes and you have to compile a new client and make everyone download it again...

Here is a trick around it:

-First of all, create an accound at <a href='http://www.no-ip.com' target='_blank'>No-IP.com</a>, add a new host and update your ip, let's use test.servegame.com to show how it works.

-download the IP update program from no-ip.com, make it execute as a service at windows, it will update the DNs with your ip every time it changes.

-open game.h and add the following lines:

Code: Select all

void GetIPByDNS();

char m_cLogServerAddrBuffer[100];
-open game.cpp and add the following lines:

where is
strcpy(m_cLogServerAddr, xxx.xxx.xxx.xxx <- some IP);
replace with

Code: Select all

strcpy(m_cLogServerAddrBuffer, "test.servegame.com");
add:

Code: Select all

void CGame::GetIPByDNS()
{
	ZeroMemory(m_cLogServerAddr, sizeof(m_cLogServerAddr));
	if (m_cLogServerAddrBuffer[0] >= 65 && m_cLogServerAddrBuffer[0] <= 122) {
  char cDnsResult[40];
  struct hostent *host_entry;

  host_entry = gethostbyname(m_cLogServerAddrBuffer);
  if (host_entry == NULL){
  	MessageBox(m_hWnd, "Failed to get DNS entry for the logserver!", "ERROR1", MB_ICONEXCLAMATION | MB_OK);
  	_exit(0);
  }
  ZeroMemory(cDnsResult, sizeof(cDnsResult));
  wsprintf(cDnsResult, "%d.%d.%d.%d",
  ( host_entry->h_addr_list[0][0] & 0x00ff ),
  ( host_entry->h_addr_list[0][1] & 0x00ff ),
  ( host_entry->h_addr_list[0][2] & 0x00ff ),
  ( host_entry->h_addr_list[0][3] & 0x00ff ));

  strcpy(m_cLogServerAddr, cDnsResult);
  }
	else strcpy(m_cLogServerAddr, m_cLogServerAddrBuffer);
}
and right after every
m_pLSock = new class XSocket(m_hWnd, DEF_SOCKETBLOCKLIMIT);
add:

Code: Select all

GetIPByDNS();
No need to do extra configs, as the function will check if it is a DNS or an IP address. If your DNS begins with a number, just use http:// in front of it.

Thats it. ;)
====<span style='color:red'><br>Aryes</span><br>====<br><br>HB United: www.hbuonline.net:<br><br><img src="http://hbtop50.com/button.php?u=hbkhispano" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=dcom" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=tinchocba" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=rafha_bernn" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=HB-Tere" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=Kiruku" alt="Helbreath Top 50 - Helbreath Silver" border="0" />
Pener
Member
Posts: 110
Joined: Fri Feb 27, 2004 3:57 pm
Location: Czech Republic

Post by Pener »

nice work Aryes all hosters with dynamic ip address are happy now i mean...

on client or on game server?
i mean its 100% client side :P


btw:
Outpost -> Helbreath -> Client Codes Submissions
<img src='http://i19.photobucket.com/albums/b153/s00pr/Pener.jpg' border='0' alt='user posted image' /><br><img src='http://i19.photobucket.com/albums/b153/ ... anner3.jpg' border='0' alt='user posted image' />
Aryes
Member
Posts: 114
Joined: Tue Aug 31, 2004 10:14 pm
Location: Brazil

Post by Aryes »

Seems to be posted at "Client Codes Submissions", what you think? :rolleyes:
====<span style='color:red'><br>Aryes</span><br>====<br><br>HB United: www.hbuonline.net:<br><br><img src="http://hbtop50.com/button.php?u=hbkhispano" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=dcom" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=tinchocba" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=rafha_bernn" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=HB-Tere" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=Kiruku" alt="Helbreath Top 50 - Helbreath Silver" border="0" />
Jensen
Loyal fan
Posts: 300
Joined: Tue Aug 02, 2005 7:40 am
Location: Illinois, USA
Contact:

Post by Jensen »

gj, woulda been nice last night when i ripped the same dns functions from the hg source to put in my client
-><-
romax
Member
Posts: 149
Joined: Sat Nov 01, 2003 10:42 am

Post by romax »

wow man your grate! i serched it for years! ;) thenks!
<img src='http://img357.imageshack.us/img357/505/eyecopy7ng.gif' border='0' alt='user posted image' />
Dshaked
&lt;3 bd long time
Posts: 747
Joined: Tue Oct 11, 2005 6:40 pm

Post by Dshaked »

Do it works :lol: ?
I will get soon 8/1mb dynamic ip, it means this is cool.
Old Helbreath Nemesis Player<br><img src='http://img232.imageshack.us/img232/9784/dshakedqc5.jpg' border='0' alt='user posted image' /><br><img src='http://img232.imageshack.us/img232/6475 ... barqj0.jpg' border='0' alt='user posted image' /><br><a href='index.php?showtopic=7107&hl=' target='_blank'>MainServer Hexing Tutorial</a><br><a href='index.php?showtopic=7663&hl=x-mas' target='_blank'>My Files</a>
SlammeR
Loyal fan
Posts: 219
Joined: Fri Nov 04, 2005 1:52 am
Location: Brazil

Post by SlammeR »

Dshaked wrote: Do it works :lol: ?
I will get soon 8/1mb dynamic ip, it means this is cool.
yes it works... 100% Tested x)
OWNED!<br><img src='http://img50.imageshack.us/img50/1386/p ... 3vsqn2.gif' border='0' alt='user posted image' /><br><br><img src="http://hbtop50.com/button.php?u=hbuonline" alt="Helbreath Top 50 - Keepin' it real." border="0" /><br><a href='http://www.hbuonline.net' target='_blank'>Helbreath United</a>
Dshaked
&lt;3 bd long time
Posts: 747
Joined: Tue Oct 11, 2005 6:40 pm

Post by Dshaked »

Ooh nice.
Old Helbreath Nemesis Player<br><img src='http://img232.imageshack.us/img232/9784/dshakedqc5.jpg' border='0' alt='user posted image' /><br><img src='http://img232.imageshack.us/img232/6475 ... barqj0.jpg' border='0' alt='user posted image' /><br><a href='index.php?showtopic=7107&hl=' target='_blank'>MainServer Hexing Tutorial</a><br><a href='index.php?showtopic=7663&hl=x-mas' target='_blank'>My Files</a>
Pener
Member
Posts: 110
Joined: Fri Feb 27, 2004 3:57 pm
Location: Czech Republic

Post by Pener »

SlammeR wrote:
Dshaked wrote: Do it works  :lol: ?
I will get soon 8/1mb dynamic ip, it means this is cool.
yes it works... 100% Tested x)
u mean aryes making codes that not works?:P :angry: <_<
<img src='http://i19.photobucket.com/albums/b153/s00pr/Pener.jpg' border='0' alt='user posted image' /><br><img src='http://i19.photobucket.com/albums/b153/ ... anner3.jpg' border='0' alt='user posted image' />
SlammeR
Loyal fan
Posts: 219
Joined: Fri Nov 04, 2005 1:52 am
Location: Brazil

Post by SlammeR »

Pener wrote:
SlammeR wrote:
Dshaked wrote: Do it works  :lol: ?
I will get soon 8/1mb dynamic ip, it means this is cool.
yes it works... 100% Tested x)
u mean aryes making codes that not works?:P :angry: <_<
noooo... i mean aryes did a good work... i tested and it works...
OWNED!<br><img src='http://img50.imageshack.us/img50/1386/p ... 3vsqn2.gif' border='0' alt='user posted image' /><br><br><img src="http://hbtop50.com/button.php?u=hbuonline" alt="Helbreath Top 50 - Keepin' it real." border="0" /><br><a href='http://www.hbuonline.net' target='_blank'>Helbreath United</a>
Dshaked
&lt;3 bd long time
Posts: 747
Joined: Tue Oct 11, 2005 6:40 pm

Post by Dshaked »

:P
Old Helbreath Nemesis Player<br><img src='http://img232.imageshack.us/img232/9784/dshakedqc5.jpg' border='0' alt='user posted image' /><br><img src='http://img232.imageshack.us/img232/6475 ... barqj0.jpg' border='0' alt='user posted image' /><br><a href='index.php?showtopic=7107&hl=' target='_blank'>MainServer Hexing Tutorial</a><br><a href='index.php?showtopic=7663&hl=x-mas' target='_blank'>My Files</a>
snoopy81
Loyal fan
Posts: 338
Joined: Mon Jul 12, 2004 7:13 pm

Post by snoopy81 »

One of the things that is a pain in the ass about having a server, is when your ip changes and you have to compile a new client and make everyone download it again...
I coded and released PatchIP 2 & 1/2 years ago for the same result.

Last version is able to patch ip even with coded and crypted clients...
_\_ _<br> / , \__/ . \ Admin of Equilibrium Project<br> II\ \___ . O<br> III \_/ \ _ / <a href='http://www.equiprojet.com' target='_blank'>http://www.equiprojet.com</a><br> II I¯I
Aryes
Member
Posts: 114
Joined: Tue Aug 31, 2004 10:14 pm
Location: Brazil

Post by Aryes »

snoopy81 wrote: I coded and released PatchIP 2 & 1/2 years ago for the same result.

Last version is able to patch ip even with coded and crypted clients...
Cool, congratulations... tho i never seen or used it...

My internet connection have dynamic ip address, so I wanted to share a code that is useful to me, i took a piece of code from hbx's hg, did some modifications and included it in the client's source. I have seen lots of HGs with something related to DNS, but never saw a client with it in the source, nor a tutorial to help people with dynamic addresses...

Never said "nobody did something like that" tho ;)
====<span style='color:red'><br>Aryes</span><br>====<br><br>HB United: www.hbuonline.net:<br><br><img src="http://hbtop50.com/button.php?u=hbkhispano" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=dcom" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=tinchocba" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=rafha_bernn" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=HB-Tere" alt="Helbreath Top 50 - Helbreath Silver" border="0" /><br><img src="http://hbtop50.com/button.php?u=Kiruku" alt="Helbreath Top 50 - Helbreath Silver" border="0" />
Post Reply