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!

[Guide] Getting other players on your server.

Junior Spellweaver
Joined
Dec 21, 2009
Messages
188
Reaction score
40
Before you can get players on your server, make sure you have already followed the server setup guide correctly. If you havnt or your not sure how to set up a server, please redirect yourself to The Server Setup Guide by -DefaulT.


Hey guys, this tutorial teaches you on how to get other players to connect to your server! You're not going to need much actually. All you need are:

- No-IP account or DynDNS account (Im using No-IP)
- Your external IP
- To Portforward (Router users)
- Your server and DB to be running.




Your external IP:
You can get your external Ip from .
You're going to need that later.



No-IP account:
You're going to need to register a no-ip account, it takes just about 5 minutes. The site can be found
The no-ip account makes it easier for users to NOT get hacked by hackers or players who can browse onto your computer and trash everything.
Anyway, after registration on the site, log in and go to the "Host/Redirect" tab and click on "Add a Host". When the page loads, I will need you to make a host name.
Example: Hostname.zapto.org

Site format:
Code:
Hostname: Make your own hostname/URL
Host type: Leave this as DNS Host(A)
IP Address: Place in your external IP. The site should have already placed it.
Leave everything else alone and click on "Create Host"
Hurray! Your done with that. Make sure your right-click and copy your Hostname/URL because you will need it later.



Portforward(Router users only):
Since everyone have different kinds of routers, here are 2 video tutorials on how to port forward your router.


Now that your portforward, here is the easy part (finally!)



Make sure you DB and Server are running:
Go to your PokeNET client and Your PokeNET server directories and run the SERVER_START.bat file. Here is the format of that:
127.0.0.1
Database name
MySQL User
MySQL Pass
Your Server name

Place your no-ip hostname/URL in the Host IP Box.
Now it should be something like:

127.0.0.1
Your Database name
Your MySQL User
Your MySQL Pass
Your Server name

Now you will need to go to the client and edit the server.txt file. You will need to place it like this format:
Code:
Admin Login
127.0.0.1
(Your Server Name)
(Your Hostname/URL)

Example of format:
Code:
Admin Login
127.0.0.1
My Game Server
Hostname.zapto.org

You're friends will use the "Your Server Name" part and you will log in using the Admin Login to get in your server. Now give the client to some friends, and your good to go.

Any questions or problems? Ask me below or ask -DefaulT
 
Last edited:
Newbie Spellweaver
Joined
Oct 12, 2009
Messages
46
Reaction score
8
Hey, uhm, what port are we forwarding? Like it doesn't clarify, and your server doesn't ask for a port either, just a bit of confusion with that one! Reply back, thanks :)
 
Newbie Spellweaver
Joined
Oct 12, 2009
Messages
46
Reaction score
8
Do you know what the default port is, if it isn't 7002, or what java file it's in? btw man, thanks to you two, I have my server up and running, just waiting to port forward and go public, but I want to get the port right.
 
Joined
Aug 16, 2006
Messages
1,251
Reaction score
199
Correct but thats if 7002 doesnt work.

Example:
7002 - TCP - HOST
7005 - UDP - HOST
7001 - TCP - CHATHOST

Code:
/**
	 * Connects to a selected server
	 */
	public void connect() {
		m_packetGen = new PacketGenerator();
		/*
		 * Connect via TCP to game server
		 */
		NioSocketConnector connector = new NioSocketConnector();
		connector.getFilterChain().addLast("codec",
				new ProtocolCodecFilter(
						new TextLineCodecFactory(Charset.forName("US-ASCII"))));
		connector.setHandler(new TcpProtocolHandler(this));
		ConnectFuture cf = connector.connect(new InetSocketAddress(HOST, 7002));
		cf.addListener(new IoFutureListener() {
			public void operationComplete(IoFuture s) {
				try {
					if(s.getSession() != null && s.getSession().isConnected()) {
						m_packetGen.setTcpSession(s.getSession());
					} else {
						messageDialog("Connection timed out.\n"
								+ "The server may be offline.\n"
								+ "Contact an administrator for assistance.", getDisplay());
						HOST = "";
						m_packetGen = null;
					}
				}catch(RuntimeIoException e){ 
					messageDialog("Connection timed out.\n"
							+ "The server may be offline.\n"
							+ "Contact an administrator for assistance.", getDisplay());
					HOST = "";
					m_packetGen = null;
				}catch (Exception e) {
					e.printStackTrace();
					messageDialog("Connection timed out.\n"
							+ "The server may be offline.\n"
							+ "Contact an administrator for assistance.", getDisplay());
					HOST = "";
					m_packetGen = null;
				}
			}
		});
		/*
		 * Connect via UDP to game server
		 */
		NioDatagramConnector udp = new NioDatagramConnector();
		udp.getFilterChain().addLast("codec",
				new ProtocolCodecFilter(
						new TextLineCodecFactory(Charset.forName("US-ASCII"))));
		udp.setHandler(new UdpProtocolHandler(this));
		cf = udp.connect(new InetSocketAddress(HOST, 7005));
		cf.addListener(new IoFutureListener() {
			public void operationComplete(IoFuture s) {
				try {
					if(s.getSession().isConnected()) {
						m_packetGen.setUdpSession(s.getSession());
					} else {
						messageDialog("Connection timed out.\n"
								+ "The server may be offline.\n"
								+ "Contact an administrator for assistance.", getDisplay());
						HOST = "";
						m_packetGen = null;
					}
				}catch(RuntimeIoException e){ 
					messageDialog("Connection timed out.\n"
							+ "The server may be offline.\n"
							+ "Contact an administrator for assistance.", getDisplay());
					HOST = "";
					m_packetGen = null;
				} catch (Exception e) {
					e.printStackTrace();
					messageDialog("Connection timed out.\n"
							+ "The server may be offline.\n"
							+ "Contact an administrator for assistance.", getDisplay());
					HOST = "";
					m_packetGen = null;
				}
			}
		});
		/*
		 * Connect via TCP to chat server
		 */
		NioSocketConnector chat = new NioSocketConnector();
		chat.getFilterChain().addLast("codec",
				new ProtocolCodecFilter(
						new TextLineCodecFactory(Charset.forName("US-ASCII"))));
		chat.setHandler(new ChatProtocolHandler());
		ConnectFuture cf2 = connector.connect(new InetSocketAddress(CHATHOST, 7001));
		cf2.addListener(new IoFutureListener() {
			public void operationComplete(IoFuture s) {
				try {
					if(s.getSession() != null && s.getSession().isConnected()) {
						m_packetGen.setChatSession(s.getSession());
						m_chatServerIsActive = true;
					} else {
//						messageDialog("Chat has been disabled.\n" +
//								"Could not connect to chat server.", getDisplay());
						m_chatServerIsActive = false;
						m_packetGen.setChatSession(null);
					}
				}catch(RuntimeIoException e){ 
//					messageDialog("Chat has been disabled.\n" +
//							"Could not connect to chat server.", getDisplay());
					m_chatServerIsActive = false;
					m_packetGen.setChatSession(null);
				}catch (Exception e) {
					e.printStackTrace();
//					messageDialog("Chat has been disabled.\n" +
//							"Could not connect to chat server.", getDisplay());
					m_chatServerIsActive = false;
					m_packetGen.setChatSession(null);
				}
			}
		});
		/*
		 * Show login screen
		 */
		if(!HOST.equals(""))
			m_login.showLogin();
	}

Code:
/*
		 * Bind the TCP port
		 */
		m_tcpAcceptor = new NioSocketAcceptor();
		m_tcpAcceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new PokenetCodecFactory()));
		m_tcpAcceptor.setHandler(m_tcpProtocolHandler);
		try {
			m_tcpAcceptor.bind(new InetSocketAddress(7002)); 
			System.out.println("INFO: TCP acceptor started.");
		} catch (Exception e) {
			e.printStackTrace();
			return;
		}
		/*
		 * Bind the UDP port
		 */
		m_udpAcceptor = new NioDatagramAcceptor();
		m_udpAcceptor.setHandler(m_udpProtocolHandler);
		DefaultIoFilterChainBuilder chain = m_udpAcceptor.getFilterChain(); 

		chain.addLast("codec", new ProtocolCodecFilter(new PokenetCodecFactory()));
		DatagramSessionConfig dcfg = m_udpAcceptor.getSessionConfig(); 
		dcfg.setReuseAddress(true);
		try {
			m_udpAcceptor.bind(new InetSocketAddress(7005)); 
			System.out.println("INFO: UDP acceptor started.");
		} catch (Exception e) {
			e.printStackTrace();
			return;
		}
		System.out.println("INFO: Network Service started.");
	}
 
Last edited:
Newbie Spellweaver
Joined
Oct 12, 2009
Messages
46
Reaction score
8
Thanks guys, seriously. You're all extremely talented. Wouldn't of been here without ya. :p
 
Newbie Spellweaver
Joined
Aug 30, 2012
Messages
36
Reaction score
0

Make sure you DB and Server are running:
Go to your PokeNET client and Your PokeNET server directories and run the SERVER_START.bat file. Here is the format of that:

127.0.0.1
Database name
MySQL User
MySQL Pass
Your Server name

Place your no-ip hostname/URL in the Host IP Box.
Now it should be something like:


127.0.0.1
Your Database name
Your MySQL User
Your MySQL Pass
Your Server name



The host ip box is where the 127 is correct? So shouldn't it look like this? :

Your no-ip hostname/URL
Your Database name
Your MySQL User
Your MySQL Pass
Your Server name
 
Back
Top