Game Development Community

Dedicated server on a port other than 28000

by Dan Rabideau · in Torque Game Engine · 01/19/2006 (2:54 pm) · 10 replies

I am having trouble getting my client to connect to a dedicated server on anything other than the defaulted port 28000.

I have tried resetting the dedicated server to 29000 in the server/prefs.cs file and also changing the client prefs.cs accordingly. When the server is set to anything other than 28000, the client times out..(doesn't find the server).

Has anyone had any luck setting up a dedicated server on any port other than the default?

#1
01/19/2006 (3:02 pm)
Blow away all instances of prefs.cs.

i see this value in at least four instances of prefs.cs in various places in the tree,

and then edit both copies of defaults.cs


- i haven't actually tested this, mind.
#2
01/19/2006 (4:17 pm)
Yup, run it on totally different ports.. tried with those ports as well, no difference. 28000, 28001, 77361, 93882 etc.

I never change it in prefs.cs though, I change it directly to not use the global, and just hardcode it.
#3
01/20/2006 (7:41 am)
Thanks.

I tried wiping out the prefs.cs but I didn't realize it was in the defaults too. I will edit that and try again.
Thanks for the quick responses.
#4
01/20/2006 (7:38 pm)
If any one else would like to comment on a way to get this to work I would appreciate it.. I tried the above suggestions and I don't get it to work.. The console log confirms my dedicated is initializing and setting up port 29000, but the client will not try to connect to 29000, every time it tries to connect, It says CDROP XX.XXX.XXX.XX: 28000 . obviously the client is still trying to connect on port 28000. Where the heck can I change this for the client.. when you mean hardcode it.. you mean set the $Pref::Net::Port to 29000 directly before the call?
#5
01/20/2006 (8:05 pm)
No. I mean calling the function to start the server with manually setting the port as a variable.
Like this:

setNetPort(7351);
      allowConnections(true);
#6
01/20/2006 (8:28 pm)
>setNetPort(73514);

Ports only go up to 65535..
#7
01/20/2006 (8:30 pm)
Was an example David, I'm sure you understand that too. I just typed a number.
#8
01/20/2006 (8:55 pm)
No, I don't understand. All I see is misinformation. Someone who needs this type of help will take your "examples" literally.

Both TCP and UDP ports range from 0-65535. Also, use an unprivileged port - one that ranges from 1024-65535.
#9
01/21/2006 (7:32 am)
What exact preference in the client did you set to your new port number?

Also, how are you connecting to the server? Torque is setup up out of the box to only grab a port address from the Query Lan/Query Master server, and that -is- hard coded to look for only port 28000 on LAN queries.
#10
01/24/2006 (10:39 am)
Thanks for the help guys. We did indeed have to hard code it, but we went about it a different way. We also disabled all the Master server code and the heartbeat function so that people wouldn't be trying to log into our dedicated with the wrong game clients.

We are no longer using the $Pref::Net::port variables and we hardcode the connection by explicitly stating the port in the argument that is passed to Connect() .. it looks like this in our code:
Connect(XX.XXX.XXX.XX:29000); well to be honest we set a variable and pass the variable instead.. but that is the information and format that is passed. It works great.

Thanks for the help!
Any questions about the use of this.. contact me directly at jhvilmaire@charter.net