Page 1 of 1

Unable to connect to server :(

Posted: 11 Jul 2023, 03:09
by Sparticus
When I try and connect to the server from my game, the 'OnConnection' event is fired with a failure response.

I have the following connection settings :

Code: Select all

public string host = "xx.xxx.xxx.xxx";  (not localhost, remote server)
    public int tcpPort = 9933;
    public int httpPort = 8080;
    public int httpsPort = 8443;
    public bool useHttpTunnel = false;
    public bool encrypt = false;
    public string zone = "BasicExamples";
    public bool debug = true;
    public LogLevel logLevel = LogLevel.INFO;
At this point I have not setup and rooms/zones. (I assume it doesn't matter until I make a connection)

I am connecting to an EC2 instance on AWS. I have opened the ports 9933 UDP, 9933 TCP and 8080 TCP.

I can view the admin console successfully.

Typing ./sfs2x-service status on the server says "sfs2x-service is running."

On the server, if I do a :
sudo tcpdump -i eth0 port 9933

to monitor all traffic to port 9933, when I load my game I see zero traffic.

I known the port is open cause if I telnet xx.xxx.xxx.xxx 9933 I see traffic.

Any guesses what I am missing? Any other tricks I can do to troubleshoot?

Thanks!

Re: Unable to connect to server :(

Posted: 11 Jul 2023, 06:52
by Lapo
Hi,
on AWS you need to configure your Security Group. Each server has one and it works like a firewall, so you need to set rules.
You should allow TCP port 9933 from all addresses as well as UDP 9933, TCP 8080 and TCP 8443

Cheers

Re: Unable to connect to server :(

Posted: 11 Jul 2023, 12:52
by Sparticus
Ya, I did that. In my previous post i also mentioned I tried telnetting to the ports and I can confirm they are open to the world

here is a screenshot of my aws security group allowing all SFS ports :

https://imgur.com/a/Sh9cCoG

Re: Unable to connect to server :(

Posted: 11 Jul 2023, 14:37
by Lapo
If telnet works from the same machine where the Unity client is run then there's probably an issue with the client itself.
I would recommend using our Connector example from our Unity Example package to test your server.
Maybe something is wrong from the client side.

See relative tutorial here:
http://docs2x.smartfoxserver.com/Exampl ... /connector
which contains a link to the download

Let us know

Re: Unable to connect to server :(

Posted: 11 Jul 2023, 17:53
by Sparticus
Ok, figured it out.

Unity does something stupid that has bit me many times before and just bit me again.

The connector code uses public variables when defining things like the host :

Code: Select all

public string host = "127,0,0,1";
Since it's public, the values are controlled with the Unity UI. For some odd reason, if you modify the values within the code, the values within the UI override it. Even though I changed the code to my server ip, the 127.0.0.1 that was originally set within the Unity UI remains there.

So, I changed the host ip to my servers ip. But since the Unity UI had it set t0 127.0.0.1, my server ip was not used.

Re: Unable to connect to server :(

Posted: 12 Jul 2023, 07:20
by Lapo
Glad it was solved! :)