How to start an internet server

Posted By: TSG_Torsten

How to start an internet server - 05/24/07 18:00

Hi!

I'm working on a small online chat and have just one question: How can i start a server in internet-mode. Everytime I start a server it shows only the LAN-IP, how can I change this? And what kinds of ports I have to open, UDP or TCP?

Thanxks for your answers!

Hi,

ich arbeite gerade an einen kleinen Online-Chat und habe eine Frage: Wie kann ich den Server im Internet-Modus starten? Jedesmal wenn ich den starte zeigt der mir auch nur meine LAN-IP an, und ich kann über meine DynDNS nicht connecten. Achja und welche Art von Port muss ich öffnen, UDP oder TCP?

Danke für jede Antwort!
Posted By: fastlane69

Re: How to start an internet server - 05/24/07 22:17

If you have a connection to the internet active with no routers or wireless or any other topology in between it should work automatically.

If you have a router between you and the net or you are using some tunneling IP tech, it may not work.
Posted By: A.Russell

Re: How to start an internet server - 05/25/07 03:53


You need to configure your router. I am not certain how to do this, since last time I did it was with a friend who is a network engineer. Firstly you go into your router with your web browser (check your router's manual for how to do this). Once inside I'm a bit vague on what we did, but if you look around in there you might find what you need. If I remeber correctly, we set a static IP for the machine we used as a server (otherwise the router might give it a different IP each time it is started) then we used .....ummmm what was it called... some acronym like for "demilitarized zone" [edit: DMZ -that's the one!] and set that to the static IP. You could then access the server from the web using the outside IP. To find your outside IP, search for "what's my IP" on Google.

I hope that was at least a little bit helpful.
Posted By: TSG_Torsten

Re: How to start an internet server - 05/25/07 15:36

Hi,

I'm not a beginner doing port forwarding and opening ports. I've already hosted different game servers. But I need the protocoll the engine is using and how to "say" it that it should use the internet ip, it always take the lan ip.

Btw. do never use DMZ, if you use it you've no security.
Posted By: giorgi3

Re: How to start an internet server - 05/25/07 16:14

The default port range is 2300-2400. It uses both TCP and UDP (but mostly UDP). You can change it with:

Quote:


-port number
Through this command line option, a port address for TCP/IP client/server communication can be given. Valid ports are in the range 2300..2400. If no port is given, a default port address is assigned. A port address can only be given for the server - the client will connect to the right port automatically.






So set port forwarding to send these through your router to the server.

As far as the client goes, you have to specify the IP address via -IP


Quote:



-ip name
Through the -IP command line option the server name, the server's machine name, domain name or IP address can be given when starting a client in multiplayer mode. Example:

acknex office -cl -ip 169.254.73.28

connects to the server with the given IP address on the network or internet. The given name or address is available during gameplay in the predefined server_name string. If this command line option is not given, the server will be searched on the local network.





If you are trying to get the game to display the internet IP vs the Local IP, I don't know that it can be done.
Posted By: TSG_Torsten

Re: How to start an internet server - 05/26/07 07:14

Hi, I've done this already. It shows me everytime my LAN-IP. I've opened the port 2300 as UDP and TCP and forwarded to my IP. But it doesn't work.
The client connects via session_connect, so I don't need -ip
Posted By: TSG_Torsten

Re: How to start an internet server - 05/28/07 11:41

No one knows something about it? I don't understand, are you all just want to programm LAN-Games? But why do you worry about Lags, LAN doesn't lag.

But Seriously: Has no one of you hosted an internet game server?
Posted By: ISG

Re: How to start an internet server - 05/28/07 12:57

Get your IP Address, go to www.my-ip.com or some website that will tell you what your IPAddress is (unless you know where you can find it on your computer). That's the IP you will have others connect to.

1) Send them your Open Source Files and Levels now.
2) Open the Main level up
3) Hit Run
4) Server enter "-sv -cl" and hit RUN
5) Client enter "-cl -ip 000.00.00.000" and hit RUN
6) Ta da...should be running together.

This is all assuming your code is prepared for Multiplayer gaming, otherwise the story could end up differently.
Posted By: TSG_Torsten

Re: How to start an internet server - 05/28/07 20:49

What's about ports? Btw. already done what you have written, nothing is running at all, there is an error, No Server found. (But I'm using a dedicated server)

My code works fine, in LAN or via Hamachi (internet-based) it works without any errors.
Posted By: Michael_Schwarz

Re: How to start an internet server - 05/29/07 00:17

In case that you are trying to connect to your own server from the same PC you work on, you have to conect to localhost (127.0.0.1) NOT to yor internet-IP, this is only for other users. You cannot connect to your own Internet-IP, you would need a special kind of router, to avoid a so called "callback" or "loopback" - dont remember the name.
Posted By: TSG_Torsten

Re: How to start an internet server - 05/29/07 12:59

I've already tryed it with other PC's or online-users. With localhost/LAN-IP/Host-name it works fine, but not via internet.
Posted By: D3D

Re: How to start an internet server - 05/29/07 16:49

What about firewall? Do those 'other' users allow activity of your application? I can confirm what Michael_Schwarz said. I have had this problem too and spend hours thinking my program didn't worked. In the end it was just that I had to connect from localhost if i'm on the same connection as the server.

My friends could login from the internet after i'd portforwarded to the server on my LAN. There were some problems with ports (bug) and firewall issues that prevent the application from working correctly at first.
Posted By: PrenceOfDarkness

Re: How to start an internet server - 05/29/07 18:13

I've had the same problem in the past. If you have a linksys router call them up (like I did) and keep calling until u finally get lucky and get the one or two people that actually know something.. believe me... that's the only way.. stupid linksys routers suck
Posted By: TSG_Torsten

Re: How to start an internet server - 05/30/07 17:24

I don't have a linksys router, and if I host other game servers I can connect via internet-ip to my own server.
Anyway, all my firewalls are deactivated.
But are you sure that I don't need to open ports? Because no one say's something about it.

If I connect from another LAN-PC to the internet-ip, is this a 'backloop', too?
Posted By: Michael_Schwarz

Re: How to start an internet server - 05/31/07 00:03

You should activate some ports, dont remember them now though - have a look for them in the manual.

And yes, conecting from a LAN PC via the internet-ip is a backloop too.
Posted By: D3D

Re: How to start an internet server - 05/31/07 15:11

See which ports are open with 'netstat -a' from command prompt. Or another gui based application that does the same. If you look above you'll notice giorgi3's reply on what the default ports are. You can change this sure.
Posted By: TSG_Torsten

Re: How to start an internet server - 06/01/07 11:14

I have opened many ports and forwaded it. I have opened the port which i have given starting the server as -port and have opened it and forwarded. I've also tryed to use DMZ.
Posted By: TSG_Torsten

Re: How to start an internet server - 06/02/07 20:48

Does no one have an idea?
Posted By: fastlane69

Re: How to start an internet server - 06/02/07 22:55

From what I gather from your responses and others, there are two options:

You have a LAN address (192.168-ish for example) and a WAN address (222.222-ish for example) on the same computer. In other words you are multi-homed. In this case you CANNOT set the IP... it will automatically default to the LAN number. Maybe if you have a public class-c address lower than 192.xxx.xxx.xxx, 3DGS might pick it up but I'm not sure. To solve disable the LAN connection, start 3DGS server, then re-enable the LAN connection.


IF on the other hand you have a router in between your server and the world, then the server will always default to the private addy (192), the clients will always connect to the public addy (222 or whatever) and your router is going to have to do the translation between public and private (NAT, port forward, DMZ).
Posted By: D3D

Re: How to start an internet server - 06/03/07 14:28

The Server running MyGame.exe
ISP: 212.110.33.219 <- adsl ip address assigned by isp
YOU: 192.168.1.56 (or 127.0.0.1 = localhost)
Port: 2332

Observer Mode: -sv -cl -ip 192.168.1.56 -port 2332 -pl TheObserver
Server Mode: sv -ip 192.168.1.56 -port 2332

Client1 running MyGame.exe

ISP: 213.107.15.33
HIS: 192.168.1.82
Connect over LAN: -cl -ip 192.168.1.56 -pl Client1
Connect over WWW: -cl -ip 212.110.33.219 -pl Client1


Client2 running MyGame.exe
ISP: 213.104.22.16
HER: 192.168.1.44
Connect over LAN: -cl -ip 192.168.1.56 -pl Client2
Connect over WWW: -cl -ip 212.110.33.219 -pl Client2


To view local ip assigned by server:
1: Goto Start|Execute
2: Type cmd and press ENTER
3: Type ipconfig and press ENTER

To view the server connection ip assigned by ISP:
http://whatismyip.com

-PORT

Through this command line option, a port address for TCP/IP client/server communication can be given. Valid ports are in the range 2300..2400. If no port is given, a default port address is assigned. A port address can only be given for the server - the client will connect to the right port automatically.

Guess the client will try any port from 2300-2400 when connecting to the server behind a router!? In my quick test I portforwarded ports ranging from 2300 to 2400 on the router to a computer on my LAN as shown above for example. Also allowed access in the firewall on the server.

No need to run the server with -ip 212.110.33.219 instead of -ip 192.168.1.56 right? This is only needed for the clients who connect from over the internet. On my router -> server if I try to run from ISP assigned ip, it loops back. The multiplayer functions are dropped without error until you restart the server.

Also I tried to get the server ip displayed. Only to find out that just like you it only broadcast the LAN assigned ip. To solve, try to find the free GSHTTP plugin here. This plugin can be used to get the real server ip assigned by your ISP inside your application.

To end. I have tried the GSHTTP plugin and it will not work without some changes. So thanks to Excessus and Michael_Schwarz here's what you need.

Download GSHTTP v1.3 (5.5+ compiled with source) or with Crypt if you like!?
Put 'GSHTTP.dll' in the folder where your project is.
Put 'gshttp.wdl' in the folder where your project is.
Open 'gshttp.wdl' in SED and replace all code with:

Code:
// GSHTTP v1.3
// All return 1 if error else returns 0 unless otherwise stated.
// id in every function is the number of the HTTP client. Start at zero.

dllfunction HTTP_Create(id); // Create HTTP Client

dllfunction HTTP_Get(id,url_str); // HTTP GET the URL in url_str
dllfunction HTTP_Post(id,url_str,data_str); // HTTP POST the URL in url_str and pass data_str as the post data
dllfunction HTTP_PostFile(id,url_str,file_str,var_str);
// HTTP POST the URL in url_str and upload the file file_str via multipart mime
// File_str is Directory of the Acknex EXE + file_str
// Content type for the upload is set to application/x-compress

dllfunction HTTP_PostFile2(id,url_str,file_str);
// HTTP POST the URL in url_str and upload the file file_str as the post data
// File_str is Directory of the Acknex EXE + file_str

dllfunction HTTP_Abort(id); // Tells the client to abort working.

dllfunction HTTP_IsWorking(id); // Check to see if HTTP_Get() or HTTP_Post() are currently working

dllfunction HTTP_Results(id,results_str); // Fill results_str with the results from HTTP_Get() or HTTP_Post().
//If there was an HTTP error, fills results_str with error number.
dllfunction HTTP_SaveToFile(id,filename_str);
// Save the results from HTTP_Get() or HTTP_Post() to a file named from the string filename_str.
// If there was an HTTP error, the file will contain an error number.
// The path of the acknex exe is added to the beginning of filename_str.
// To save into the main dir of your application filename_str would equal "blah.mdl".
// To save into a sub dir of your main application dir your filename_str would equal "\\blah\\blah.mdl".
// Back slashs in AckNex strings need to be double slashed or they are ignored.

dllfunction HTTP_Free(id); // Free HTTP Client
// Free HTTP clients from the end of the list first (100, 99, 98...).
// Freeing HTTP clients in the middle will move clients after it up in the list.
// If you have 10 clients and you free #5, #6 will become #5 and so on. There will be 9 clients in the list.

string IP_Adress;

function GET_IP_ADR
{
if(HTTP_Create(0) == 0)
{
HTTP_Get(0, "http://www.yourdomain.com/ip.php");
while(HTTP_IsWorking(0))
{
wait(1);
}
HTTP_Results(0, IP_Adress);
HTTP_Free(0);
}
}
on_p=Get_IP_ADR;

/*
var ResultString;
ACTION GetWebPage {

dll_handle = dll_open("GSHTTP.dll");

if (HTTP_Create(0)==0) {


HTTP_Get(0,"http://www.google.com");

while(HTTP_IsWorking(0)==1) {
waitt(16);
}

ResultString=" ";
HTTP_Results(0,ResultString);

msg_show(ResultString,10);

HTTP_Free(0);

}

dll_close(dll_handle);

}


var PostString;
var ResultString;
ACTION PostWebPage {

dll_handle = dll_open("GSHTTP.dll");

if (HTTP_Create(0)==0) {


PostString="a=b";

HTTP_Post(0,"http://www.yahoo.com/",PostString);

while(HTTP_IsWorking(0)==1) {
waitt(16);
}

ResultString=" ";
HTTP_Results(0,ResultString);

msg_show(ResultString,10);

HTTP_Free(0);

}

dll_close(dll_handle);

}
*/



Open your your main.wdl file and include 'gshttp.wdl' in my sample all other wdl files are inside 'code' directory, your setup might be different.

Code:
PLUGINDIR = "."; // open Dlls in the "plugins" subfolder

path ".\\code"; // code

include "gshttp.wdl";

font justarial = "arial" , 1 , 14; // 1 = bold
var video_mode = 7; // 800x600
var video_depth = 32; // 32bit color
var video_screen = 2; // 1=full 2=window
var fps_max = 60;

text TheServerIP // display the server ip
{
layer = 5;
strings=1;
string=IP_Adress;
pos_x=75;
pos_y=375;
red = 192;
green = 192;
blue = 192;
font=justarial;
flags = visible;
}



To run press P on keyboard.

Oh, but wait we need some kind of php script first to get the real server ip address. Put this code inside a text file and save as ip.php, then upload the file in ASCII mode to any host that support PHP.

Code:
<?php

// This will display the server IP

$TheServerIP = $_SERVER['REMOTE_ADDR'];
print $TheServerIP;

?>



Open 'gshttp.wdl' and edit to reflect your own domain:
HTTP_Get(0, "http://www.yourdomain.com/ip.php");

Run your application and press P. Now it displays your real server ip address.

All IP addresses in this post are fake and used for example only. Sorry if one of them belongs to someone.
Posted By: fastlane69

Re: How to start an internet server - 06/04/07 01:33

You can't assign server ip directly. It will always default (AFAIK) to the lowest address on your computer. Hence since 212 is higher than 192, it will always have a 192 addy no matter what you do.

But from what I can tell, port-forwarding should be no problem in getting you from WAN to LAN.

I have posted a bug regarding the port assignment. I don't recognize your symptons but it's starting to sound like the same thing. Go to the bug forum and look for my -port bug posting. See if your problem looks similar. Then maybe you can "bump" that or post a new bug yourself.
Posted By: D3D

Re: How to start an internet server - 06/04/07 03:44

Don't understand what you meant with can't assign ip to server?

Replace this
Observer Mode: -sv -cl -ip 192.168.1.56 -port 2332 -pl TheObserver
Server Mode: sv -ip 192.168.1.56 -port 2332

With this?
Observer Mode: -sv -cl -port 2332 -pl TheObserver
Server Mode: sv -ip -port 2332

The client must input the ISP assigned ip of the connection used by the server otherwise he or she would stay on his her own LAN until time-out.
Posted By: fastlane69

Re: How to start an internet server - 06/04/07 19:00

Quote:

Observer Mode: -sv -cl -ip 192.168.1.56 -port 2332 -pl TheObserver
Server Mode: sv -ip 192.168.1.56 -port 2332





Setting -ip on a server has no effect. Hence writing out the IP is irrelevant; The IP will be the lowest addy it finds on the machine. Hence if you have a 192 addy, it will always be that one.

Put another way, suppose you had a 168 addy on the same box as the 192. Even if you wrote the 192 addy explicitly (as you have above), 3DGS will still AFAIK assign the server the 168 addy.

So to answer your question, the above and the below...

Quote:

Observer Mode: -sv -cl -port 2332 -pl TheObserver
Server Mode: sv -ip -port 2332




...do exactly the same.
Posted By: D3D

Re: How to start an internet server - 06/06/07 16:23

Yes you are right. I thought I had to start with -sv -ip -port, but the engine will know the ip address.
Posted By: TSG_Torsten

Re: How to start an internet server - 06/06/07 18:46

Hi guys, thank you all for your support.
I've got it. You've to start the client with -port 2300 or else, but you can connect by session_connect or via -cl, that works.

That's all, thank you really much, and now have fun programming your own online games!
Posted By: fastlane69

Re: How to start an internet server - 06/06/07 18:50

Quote:

You've to start the client with -port 2300 or else,




So it was a port error. Yeah I noticed bad connection behaiviour too a while back and traced it back to their port assignement. I posted it as a bug and it was confirmed but I'm not sure what the "fix" status is. I guess I should go back and check.
Posted By: D3D

Re: How to start an internet server - 06/06/07 19:52

As the default ports range from 2300 to 2400, does this imply that with Gamestudio Pro you can host a maximum of 1000 players?
Posted By: fastlane69

Re: How to start an internet server - 06/06/07 23:26

There is no correspondance between ports and players. You can have 1000 players on 1 port or 1 player per port... doesn't make a difference (though in the latter case, you could only ever have 100 players).

No, the problem is that if you have more than one server on a machine, each has to have it's own port for clients to connect into. The current bug AFAIK makes it so that you can only assign one port no matter what. This is why having multiple servers on one computer was problematic. Furthermore, it is my guess that 2300 is the default port assigned.

Try this:

Set the -port of the server directly to 2333 and try to connect with a client. Did it work?
Now, set the -port again to 2333 and try to connect with a client and set THEIR -port as well. Did it work?
Posted By: D3D

Re: How to start an internet server - 06/07/07 01:33

Doesn't work in A6.60 and the port manager shows the server is dropping all ports needed for multiplayer. Then just sit there like nothing happend. No error message. Clients can't connect anymore. Don't know how it will work with A7, because I cannot even trial it until Conitec release my key.

The manual says clients don't need port assigned they obtain them automatically. The server can be run with port ranging from 2300 to 2400. What I don't understand is why I would want to run the server on any port? If the client doesn't have to know it because the engine will connect to the correct port!

So the client connects with -cl -ip -pl, and then the engine on client side will try all ports (2300-2400) on the server until one matches with the one i've set with -sv -port. Or try all in the case no port was set at all? Don't understand the logic behind it. Looks almost like ports are only good for when you own Gamestudio Pro as you can setup more than one server with that edition.

What I would like to know, is how the client application finds the server port if the server is behind a router. Does the server penetrate the router or vice versa? Or does the client-side application just try port 2300, 2301 etc etc until it matches!?

Oh and wait there is one reason why I would want the port feature. For instance when I have another application that must be run on one of the ports acknex engine uses for multiplayer functions and want to prevent any conflict between them.
Posted By: fastlane69

Re: How to start an internet server - 06/07/07 18:57

Quote:

The manual says clients don't need port assigned they obtain them automatically. The server can be run with port ranging from 2300 to 2400. What I don't understand is why I would want to run the server on any port? If the client doesn't have to know it because the engine will connect to the correct port!




Still buggy in 6.6... thanks!

The client will scan automatically from 2300 to 2400 until if finds a 3DGS server. Therefore using -port on the client is unnecessary and that is another bug, that we actually have to manually input the -port on the client. What it should work like is that the client doesn't need to -port but the server does and the server doesn't need to -ip but the client does (unless session_connecting).

Do me a favor and put another bug report up. I fear mine may have been lost in the shuffle. I will then go and post my bug as an addendum to your post and a reminder to conitec to get it fixed soon!

Quote:

What I would like to know, is how the client application finds the server port if the server is behind a router. Does the server penetrate the router or vice versa? Or does the client-side application just try port 2300, 2301 etc etc until it matches!?




Exactlly, it will scan until found. If you are behind a router, your best bet is to use port-forwarding so the correct message automatically goes to the correct server.
Posted By: giorgi3

Re: How to start an internet server - 06/07/07 19:34

Also note that some routers have a "gaming" option. Turning this on opens up ports 2300-2400. These ports are actually used by DirectX, which is what GameStudio uses for it's networking engine.

From Microsofts website:

Quote:



Using DirectX 8 or a later version
Connection Ports for Client Configuration Ports for Host Configuration
Initial UDP Connection 6073 Outbound 6073 Inbound
Subsequent UDP Inbound 2302-2400 2302-2400
Subsequent UDP Outbound 2302-2400 2302-2400






© 2024 lite-C Forums