Page 1 of 1

"Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 02 Oct 2022, 13:06
by Artificialized
Hello well I am still trying to connect to the server through the unity C# Api. It throw's a error. Idk what I am doing wrong I followed the documentation thoroughly for over 15 hours. I am just trying to be able to connect to the game server and test things out. Which Ip-address is suppose to go in the Host? Sorry bare with me I am trying to figure out why none of my post aren't going through I sent 2-3 so far...Kind of tedious anyways. I am using Unity version 2021.3.11f1 Personal.

I setup the server through the server admin tool panel.
I setup a Zone
I setup a room
I input my Tcp Udp Ip addresses and ports.
I submit it then reloaded then restarted the server I tried connecting and it threw a error cannot connect to server.

I am using Smartfoxserver2x latest version and unity 2021.3.11f1 Personal edition.
I am using the C# Api I have not made any extensions or anything or edited the scenes and or project files. I just simply followed the documentation thoroughly for nearly 15+ hours.

Please if anyone can help me here is a picture below of what it says when I try to connect.

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 02 Oct 2022, 14:29
by Lapo
Hi,
all our examples are configured to connect to the "localhost", i.e. the local machine. If client and server are not on the same physical machine then you'll need to change the address the client uses to the server's public IP address.

Cheers
p.s. =
I am trying to figure out why none of my post aren't going through I sent 2-3 so far

Your very first post on this board goes through a moderation queue, to filter out spam, so it won't appear immediately. From now on your messages will be posted immediately.

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 02 Oct 2022, 14:46
by Artificialized
Oh so i need a server to test the unity spacewar2 example?

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 02 Oct 2022, 15:30
by Artificialized
i changed the ip address the client uses to my ipv4 address under ipconfig in cmd prompt how would one go about setting up the SpaceWar2 demo with a digital ocean droplet server

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 03 Oct 2022, 07:57
by Lapo
Artificialized wrote:Oh so i need a server to test the unity spacewar2 example?

It is a multiplayer demo :)
You need SmartFoxServer 2X installed and running on your local machine. That's how all of the Examples work, by connecting to the local server.

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 03 Oct 2022, 07:58
by Lapo
Artificialized wrote:i changed the ip address the client uses to my ipv4 address under ipconfig in cmd prompt how would one go about setting up the SpaceWar2 demo with a digital ocean droplet server

Were you able to run the demo on your local machine? I would do that before attempting the next step, at least to familiarize with the process.

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 03 Oct 2022, 13:43
by Artificialized
I could not get pass the login it says CONNECTION LOST: REASON UNKNOWN.

I have the Smartfoxserver2x running i made my Zone SpaceWar2,added a room called Space configured the zone and room and proceeded to unity to run the demo in the editor it throw's a CONNECTION LOST: REASON UNKNOWN.

I also followed the tutorial step's to get it up and running but it wont login.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1.unzip the examples package;
2.under the SmartFoxServer's /SFS2X/extensions folder, create the SpaceWar2 subfolder;
3.copy the /Server/SpaceWar2/Extension-Java/deploy folder's content to the server's /SFS2X/extensions/SpaceWar2 folder just created;
4.copy the SpaceWar2.zone.xml file (containing the Zone configuration) from the /Server/SpaceWar2/Zone folder to your SFS2X installation folder, under /SFS2X/zones;
5.start SmartFoxServer 2X (v2.13 or later is highly recommended);
6.launch the Unity Hub, click on the Open button and navigate to the /Client/SpaceWar2 folder;
**if prompted, select the Unity Editor version to use (v2021.3 or later is recommended);
7.go to the Project panel, click on the /Assets/Scenes folder and double click on the Login scene to open it;
8.click on the Play button to run the example in the Unity Editor, or go to the Build settings panel and build it for your target platform of choice.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I was stumbled on step number 4. seeing i couldn't figure out where to paste the SpaceWar2.one.xml file containting the ZONE configuration from the /Server/SpaceWar2/Zone folder to your SFS2X installation folder, under /SFS2X/zones;.

because there is No (/SFS2X/zones) folder.

9.I built a webgl,and standalone version neither of which worked.

Also i had to reset my router/modem to re-configure the smartfoxserver2x admin tool so it would let me login.So in the future if anyone gets locked out of their smartfoxserver2x admin tool login all they have to do is delete the smartfoxserver2x then shut computer off reset router/modem wait 5 minutes turn computer on then reinstall smartfoxserver2x start the server then proceed to login with the correct credentials in the admin tool panel.

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 03 Oct 2022, 15:01
by Artificialized
Lapo wrote:
Artificialized wrote:i changed the ip address the client uses to my ipv4 address under ipconfig in cmd prompt how would one go about setting up the SpaceWar2 demo with a digital ocean droplet server

Were you able to run the demo on your local machine? I would do that before attempting the next step, at least to familiarize with the process.

No i was not able to get the demo scene to run on my local machine and i have portforwarded the ip address and ports.

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 04 Oct 2022, 07:31
by Bax
If you get a "connection lost" error message, it means that the client connected but didn't complete the login step.
Did you check the Unity console for possible errors? Maybe something is preventing the login step execution.

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 04 Oct 2022, 13:27
by Artificialized
Bax wrote:If you get a "connection lost" error message, it means that the client connected but didn't complete the login step.
Did you check the Unity console for possible errors? Maybe something is preventing the login step execution.


Well there arent any unity errors in the console log

this is what the console log say's.

GLOBAL MANAGER READY

SFS2X API VERSION 1.7.17

CONNECTION MODE IS WEBSOCKET (BINARY)

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 04 Oct 2022, 13:34
by Bax
The API version and the connection mode are printed after the connection is established (see LoginSceneController script, OnConnection method). Then the login is attempted and either a LOGIN or LOGIN_ERROR event should be received by the client.
If no event is received, then something wrong is happening on the server side. Did you check the server-side logs for possible errors?

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 04 Oct 2022, 14:12
by Artificialized
I believe I have the server-side problem fixed as it wasn't in my allowed in my programs for my firewall. Also I disabled custom login is that ok?Now im stuck on the level selector.Deep Space or Saturn so basically im stuck in the lobby selector.I clicked both the deep space and saturn neither of which load the scenes.It throws a a unepected disconnection occured: reason is because i left it idle to see if it would throw any console errors it doesnt.


i checked the debug log and it keeps showing Data read data written Binary size... then Ping pong with SFS (INFO) Message PING PONG

Re: "Unity" Error Cannot connect to server and cant access localhost:8080...

Posted: 04 Oct 2022, 16:06
by Bax
When you select the level, a request is sent to the server-side Extension. If nothing happens, then something wrong is happening on the server side. Again check the server logs.