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.


smile