Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[TUTORIAL] Run more than 1 server on the same machine

Status
Not open for further replies.
Junior Spellweaver
Joined
Jan 3, 2007
Messages
145
Reaction score
27
Since a lot of people have requested that feature and i know how to do it, i am making this tutorial, this tutorial is NOT noob friendly, because it need to edit some things via ASM (explained in the tutorial) and change some data in a DLL and compile it.

First of all, i will explain why when you run 2 matchservers in the same PC one of them gets Agent Error, the MatchServer use two ports (only one of those are easily configurable, the TCP Port), one is the 6000 and the other is the port 7777.

The port 6000 are used to recv and send normal packets like the login packet, char list packet, etc..., but the 7777 is a UDP port, is used by the client to receive some information about the peers, when you run another server, you only change the TCP port but not the UDP one, so the client cant get the peer information from the 2nd server because its owned by the first one.

To avoid that problem we need to make two changes, one on the client side part and the other in the server part.

Server Part:

Open up the MatchServer.exe in ollydbg, wait until the analysis has been finished and do this steps.

  • Right click in the CPU view ( where all the ASM code is shown )
  • Select Search For -> All Constant
  • A new dialog will apear, with 3 text boxes, in the 2nd box (the signed one) put 7777 and click ok.
  • You now will be in the results window, you will see two PUSH 1E61, double click in the first one.
  • You now will be in the magical line, double click on it to modify the value to PUSH ThePort, be careful because its a hexadecimal number ( 1E61 = 7777 ).
  • Save that number because you will need it later
  • Do the same for all of your servers but remember to use a different port on each one.
  • You are done.
Client Part:

I have attached to the post a example DLL project, download and open it and read the comments.

You also need to change the IP to a different IP in your 2nd server at the ServerStatus table, you cant have the same ip for the two servers in the serverstatus table-
 

Attachments

You must be registered for see attachments list
Legendary Battlemage
Joined
Jan 28, 2008
Messages
695
Reaction score
53
Nice, Very Thanks Lambda, I really need this. :D
 
Elite Diviner
Joined
Apr 23, 2006
Messages
415
Reaction score
45
Great thing that a great coder like you is posting a great source =P
Btw I'm getting lots of problems on compiling CDetour class, already tried VS 6.0 VS 2005 and 2008, now im trying to find a link to download VS 2003.
Thanks for sharing,
 
Junior Spellweaver
Joined
Jan 3, 2007
Messages
145
Reaction score
27
I use the .NET 2003 ( the one maiet uses ), for me is the best VS that microsoft have created along with the C++ compiler.
 
Custom Title Activated
Loyal Member
Joined
Nov 5, 2006
Messages
1,358
Reaction score
15
olly won't find the 7777 constant, it returns me a LEAVE command.
7796A11A LEAVE (Initial CPU selection)

I think it's cause i dont have SQL installed on this machine.
 
Master Summoner
Joined
Oct 7, 2008
Messages
580
Reaction score
15
THanks a lot lambda finally

need 1 help,
1E61 = 7777
???? = 7788
 
DRGunZ 2 Creator
Loyal Member
Joined
Jan 21, 2007
Messages
4,493
Reaction score
161
Since a lot of people have requested that feature and i know how to do it, i am making this tutorial, this tutorial is NOT noob friendly, because it need to edit some things via ASM (explained in the tutorial) and change some data in a DLL and compile it.

First of all, i will explain why when you run 2 matchservers in the same PC one of them gets Agent Error, the MatchServer use two ports (only one of those are easily configurable, the TCP Port), one is the 6000 and the other is the port 7777.

The port 6000 are used to recv and send normal packets like the login packet, char list packet, etc..., but the 7777 is a UDP port, is used by the client to receive some information about the peers, when you run another server, you only change the TCP port but not the UDP one, so the client cant get the peer information from the 2nd server because its owned by the first one.

To avoid that problem we need to make two changes, one on the client side part and the other in the server part.

Server Part:

Open up the MatchServer.exe in ollydbg, wait until the analysis has been finished and do this steps.

  • Right click in the CPU view ( where all the ASM code is shown )
  • Select Search For -> All Constant
  • A new dialog will apear, with 3 text boxes, in the 2nd box (the signed one) put 7777 and click ok.
  • You now will be in the results window, you will see two PUSH 1E61, double click in the first one.
  • You now will be in the magical line, double click on it to modify the value to PUSH ThePort, be careful because its a hexadecimal number ( 1E61 = 7777 ).
  • Save that number because you will need it later
  • Do the same for all of your servers but remember to use a different port on each one.
  • You are done.
Client Part:

I have attached to the post a example DLL project, download and open it and read the comments.

You also need to change the IP to a different IP in your 2nd server at the ServerStatus table, you cant have the same ip for the two servers in the serverstatus table-
Very nice tutorial Lambda :) why don't it work with the same ip though?
 
Elite Diviner
Joined
Apr 23, 2006
Messages
415
Reaction score
45
THanks a lot lambda finally

need 1 help,
1E61 = 7777
???? = 7788

7788 = 1EC6 hex

You can use windows calculator on scientific mode for doing this kinda conversions.

Very nice tutorial Lambda :) why don't it work with the same ip though?

I was wondering the same. Why you can't run them at the same IP, since you already changed the ports?
 
Junior Spellweaver
Joined
Jan 3, 2007
Messages
145
Reaction score
27
7788 = 1EC6 hex

You can use windows calculator on scientific mode for doing this kinda conversions.



I was wondering the same. Why you can't run them at the same IP, since you already changed the ports?

The different IP's are used to identify the server to change the port on the client too, if you dont use the DLL in the client it will always try to connect by the 7777 port.
 
Rival Gamers Owner
Loyal Member
Joined
Jul 7, 2007
Messages
962
Reaction score
161
mind releaseing how to asm edit a dll to auto inject a dll files .
 
Newbie Spellweaver
Joined
Sep 17, 2007
Messages
49
Reaction score
3
Create DLL and Hook Client

PUSH Offeset Name DLL
LoadLibrerayA
JMP EntryPoint
 
Status
Not open for further replies.
Back
Top