[Tutorial] How to get your server running on WAN

06/10/2009 10:48 Andrew.A#1
1) Port Forward all the ports required. If your not sure how to then visit [Only registered and activated users can see links. Click Here To Register...]
Code:
PORTS
9958
5817 
5816
2) Put these IP's in the places stated below.
GameServer
MasterSocket=Your IP in both places
DatabaseConnection=127.0.0.1

LoginServer
MasterSocket= Your IP in both places
DatabaseConnection=127.0.0.1
AuthSocker=127.0.0.1 in both places
PacketProcessor=
Code:
                    if (ServerName == "SERVERNAMELoc")// For YOU
                        {
                            if (AuthSocket.Authorize(AccountName, Key, false)) //Enable YOU
                            {
                                CSocket.Send(Packets.AuthResponse("127.0.0.1", Key1, Key2));
                            }
                            else
                            {
                                CSocket.Disconnect();
                            }
                        }
                    else if (ServerName == "SERVERNAME")
                        {
                            if (AuthSocket.Authorize(AccountName, Key, false)) // Enable Public
                            {
                                CSocket.Send(Packets.AuthResponse("YOUR IP", Key1, Key2));
                            }
                            else
                            {
                                CSocket.Disconnect();
                            }
                        }
	        	}
	        	else if(DBPass == "")
	        	{
	        		Console.WriteLine("[LoginServer](Diagnostic) Set password for " + AccountName);
	        		Database.Database.SetPass(AccountName, Password);
	        		//OKAY to login!
	        		uint Key = (uint)(Random.Next(10000000) << 32);
	        		Key = Key << 32;
        			Key = (uint)(Key | (uint)Random.Next(10000000));
        			byte[] Key1 = new byte[4];
			        byte[] Key2 = new byte[4];
			        Key1[0] = (byte)(((ulong)Key & 0xff00000000000000L) >> 56);
			        Key1[1] = (byte)((Key & 0xff000000000000) >> 48);
			        Key1[2] = (byte)((Key & 0xff0000000000) >> 40);
			        Key1[3] = (byte)((Key & 0xff00000000) >> 32);
			        Key2[0] = (byte)((Key & 0xff000000) >> 24);
			        Key2[1] = (byte)((Key & 0xff0000) >> 16);
			        Key2[2] = (byte)((Key & 0xff00) >> 8);
			        Key2[3] = (byte)(Key & 0xff);
                    if (ServerName == "YOUSERVERNAMELoc")// For YOU                    {
                        if (AuthSocket.Authorize(AccountName, Key, false)) // Enable You
                        {
                            CSocket.Send(Packets.AuthResponse("127.0.0.1", Key1, Key2));
                        }
                        else
                        {
                            CSocket.Disconnect();
                        }
                    }
                    else if (ServerName == "SERVERNAME")
                    {
                        if (AuthSocket.Authorize(AccountName, Key, false)) // Enable Public
                        {
                            CSocket.Send(Packets.AuthResponse("YOUR IP", Key1, Key2));
                        }
                        else
                        {
                            CSocket.Disconnect();
                        }
                    }
                    CSocket.Disconnect();
	        	}
	        	else
	        	{
	        		CSocket.Send(Packets.WrongPass());
	        		CSocket.Disconnect();
	        	}
	        }
	        else
	        {
	        	Console.WriteLine("DBPass equals ERROR: " + DBPass);
	        	CSocket.Disconnect();
	        }
		}
	}
}

3) Open Server.dat and COPY AND PASTE THIS for you and edit where stated
Code:
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="cq2">
	<table_structure name="outenserver">
		<field Field="id" Type="smallint(1) unsigned zerofill" Null="NO" Key="PRI" Default="0" Extra="" />
		<field Field="ServerName" Type="varchar(32)" Null="YES" Key="" Extra="" />
		<field Field="ServerIP" Type="varchar(15)" Null="YES" Key="" Extra="" />
		<field Field="ServerPort" Type="int(1) unsigned" Null="YES" Key="" Extra="" />
		<field Field="FlashName" Type="varchar(32)" Null="YES" Key="" Extra="" />
		<field Field="FlashIcon" Type="varchar(32)" Null="YES" Key="" Extra="" />
		<field Field="FlashHint" Type="varchar(128)" Null="YES" Key="" Extra="" />
		<field Field="Child" Type="tinyint(1) unsigned zerofill" Null="NO" Key="" Default="0" Extra="" />
		<key Table="outenserver" Non_unique="0" Key_name="id" Seq_in_index="1" Column_name="id" Collation="A" Cardinality="97" Null="" Index_type="BTREE" Comment="" />
		<options Name="outenserver" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="97" Avg_row_length="58" Data_length="5644" Max_data_length="281474976710655" Index_length="2048" Data_free="0" Create_time="2008-11-26 08:33:09" Update_time="2008-12-18 08:39:35" Collation="latin1_swedish_ci" Create_options="" Comment="" />
	</table_structure>
	<table_data name="outenserver">
	<row>
		<field name="id">0</field>
		<field name="ServerName"></field>
		<field name="ServerIP"></field>
		<field name="ServerPort">0</field>
		<field name="FlashName"></field>
		<field name="FlashIcon"></field>
		<field name="FlashHint"></field>
		<field name="Child">1</field>
	</row>
	<row>
		<field name="id">1</field>
		<field name="ServerName"></field>
		<field name="ServerIP"></field>
		<field name="ServerPort">0</field>
		<field name="FlashName">Group1</field>
		<field name="FlashIcon">Group11.swf</field>
		<field name="FlashHint"></field>
		<field name="Child">1</field>
	</row>
<row>
		<field name="id">101</field>
		<field name="ServerName">[COLOR="red"]ServerName[/COLOR]Loc</field>
		<field name="ServerIP">127.0.0.1</field>
		<field name="ServerPort">9958</field>
		<field name="FlashName">[COLOR="Red"]ServerName[/COLOR]</field>
		<field name="FlashIcon">Group3/server2.swf</field>
		<field name="FlashHint"></field>
		<field name="Child">0</field>
	</row>
	</table_data>
</database>
</mysqldump>
4) Copy Server.dat to Desktop or somewhere and COPY AND PASTE this and edit where required.

Code:
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="cq2">
	<table_structure name="outenserver">
		<field Field="id" Type="smallint(1) unsigned zerofill" Null="NO" Key="PRI" Default="0" Extra="" />
		<field Field="ServerName" Type="varchar(32)" Null="YES" Key="" Extra="" />
		<field Field="ServerIP" Type="varchar(15)" Null="YES" Key="" Extra="" />
		<field Field="ServerPort" Type="int(1) unsigned" Null="YES" Key="" Extra="" />
		<field Field="FlashName" Type="varchar(32)" Null="YES" Key="" Extra="" />
		<field Field="FlashIcon" Type="varchar(32)" Null="YES" Key="" Extra="" />
		<field Field="FlashHint" Type="varchar(128)" Null="YES" Key="" Extra="" />
		<field Field="Child" Type="tinyint(1) unsigned zerofill" Null="NO" Key="" Default="0" Extra="" />
		<key Table="outenserver" Non_unique="0" Key_name="id" Seq_in_index="1" Column_name="id" Collation="A" Cardinality="97" Null="" Index_type="BTREE" Comment="" />
		<options Name="outenserver" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="97" Avg_row_length="58" Data_length="5644" Max_data_length="281474976710655" Index_length="2048" Data_free="0" Create_time="2008-11-26 08:33:09" Update_time="2008-12-18 08:39:35" Collation="latin1_swedish_ci" Create_options="" Comment="" />
	</table_structure>
	<table_data name="outenserver">
	<row>
		<field name="id">0</field>
		<field name="ServerName"></field>
		<field name="ServerIP"></field>
		<field name="ServerPort">0</field>
		<field name="FlashName"></field>
		<field name="FlashIcon"></field>
		<field name="FlashHint"></field>
		<field name="Child">1</field>
	</row>
	<row>
		<field name="id">1</field>
		<field name="ServerName"></field>
		<field name="ServerIP"></field>
		<field name="ServerPort">0</field>
		<field name="FlashName">Group1</field>
		<field name="FlashIcon">Group11.swf</field>
		<field name="FlashHint"></field>
		<field name="Child">1</field>
	</row>
<row>
		<field name="id">101</field>
		<field name="ServerName">[COLOR="red"]ServerName[/COLOR]</field>
		<field name="ServerIP">YOURIP</field>
		<field name="ServerPort">9958</field>
		<field name="FlashName">[COLOR="red"]ServerName[/COLOR]</field>
		<field name="FlashIcon">Group3/server2.swf</field>
		<field name="FlashHint"></field>
		<field name="Child">0</field>
	</row>
	</table_data>
</database>
</mysqldump>

If I have put the word Loc in then leave that there please

If this helps hit Thanks

=)

Credits
Me for tutorial
yuko for showing me
velorian for AuthSocket fix
06/10/2009 13:07 arab4life#2
umm i haven't tested it, but looks good
ill give u a +1 for trying
if anyone else says shit about this post, they can lick my left nut -
he is only helping.
06/10/2009 13:18 BlooD-BoY#3
i bet every person on this forum new how to do that, make a step by step on how to port forward...then it might help and maybe you should give the ports too? o.O
06/10/2009 13:30 arab4life#4
Quote:
Originally Posted by BlooD-BoY View Post
i bet every person on this forum new how to do that, make a step by step on how to port forward...then it might help and maybe you should give the ports too? o.O
[Only registered and activated users can see links. Click Here To Register...]
06/10/2009 13:45 yuko#5
Quote:
Originally Posted by BlooD-BoY View Post
i bet every person on this forum new how to do that, make a step by step on how to port forward...then it might help and maybe you should give the ports too? o.O
Port forward isn't that hard. If you have access to the router.
Most likely 192.168.x.1
Than the ports needed depends on how you want to host.
if you have a website you'll need to forward the port 80 which is the default port of HTTP
if you wanna have an ftp access you'll be better to open 21 or any other port, that you do remember.

for the server you can open all ports
9958
5817 <- not really needed
5816

router.
When you access the router. you'll have to insert a pass and id. default it should be admin admin.
ones inside the router you'll see like a website. search around without messing. if you found port forward or port mapping you'll have to add new key / port / name

for those with dynamic Ip's you might find an option No-Ip or you'll have to go to the website [Only registered and activated users can see links. Click Here To Register...]

That’s about all there is to know
06/10/2009 13:47 Zanzibar#6
Quote:
Originally Posted by BlooD-BoY View Post
i bet every person on this forum new how to do that, make a step by step on how to port forward...then it might help and maybe you should give the ports too? o.O
Amazingly, not. A lot of people don't know how to port forward. Anyways, look inside the source and you can find the source.
06/10/2009 13:49 Zanzibar#7
Quote:
Originally Posted by yuko View Post
for the server you can open all ports
9958
5817 <- not really needed
5816
AUTH_PORT = 5817;

SHIET FORGOT TO EDIT.
06/10/2009 17:28 Andrew.A#8
Quote:
Originally Posted by BlooD-BoY View Post
i bet every person on this forum new how to do that, make a step by step on how to port forward...then it might help and maybe you should give the ports too? o.O
Lol i get people emailing me on how to do it so obivously not everybody knows.

Btw this is tried and tested and if you get any problems can you post them here.
06/10/2009 23:24 EatMyChidori#9
i dont get the auth port part what do you mean by their ip?
06/10/2009 23:29 Andrew.A#10
Quote:
Originally Posted by EatMyChidori View Post
i dont get the auth port part what do you mean by their ip?
Oops that was a typo its went to be "Your IP"
06/11/2009 02:37 velorian#11
k problem :D

Code:
[LoginServer] trisky logging in to CoEmu
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it ***.***.***.105:5817
at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
at System.Net.Sockets.Socket.Connect(String host, Int32 port)
at CoEmu_v2_LoginServer.Connections.AuthSocket.Authorize(String user, UInt32 key, Boolean nano)
first server setup ftl :(
06/11/2009 05:11 EatMyChidori#12
i get this
06/11/2009 05:28 kennylai#13
Problem: [Only registered and activated users can see links. Click Here To Register...]
06/11/2009 05:45 EatMyChidori#14
Quote:
Originally Posted by kennylai View Post
Problem: [Only registered and activated users can see links. Click Here To Register...]
if you followed the guide by letterx im guessing you deleted this

'; Min Pool Size = 300; Max Pool Size = 900

in gameserver>database connections if you did put it bak in line 30
06/11/2009 06:41 kennylai#15
Yeah, I followed this guide too, and did what you said. Still doesn't work.