Unity FPS demo and external IP access

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

markypoos
Posts: 4
Joined: 09 May 2012, 01:14

Unity FPS demo and external IP access

Postby markypoos » 09 May 2012, 03:14

Hiya,

I have just started looking at Unity for SFS for game development. I've installed SFS on my home Windows 7 64-bit PC, added the local IP address UDP and TCP to the SFS server config socket addresses, added in the FPS extension into SFS/proggy files/extensions, and restarted the SFS service.

The Unity FPS demo runs fine on the local PC connecting to 127.0.0.1 but when I fire up the FPS client on my PC at work it is unable to connect to the SFS server.

The SFS log shows the following error twice a couple of seconds apart:

09 May 2012 15:06:18,044
WARN
SocketReader
v2.protocol.SFSIoHandler
Discard UDP packet from <myworkrouterip>:65438, reason: User does not exist, id: 23

The client just sits there for a few minutes after clicking the LOGIN button, eventually it'll come up with a connection lost error.

I have setup port forwarding and firewall rules for ports 8080 TCP and 9933 TCP and UDP, and I can connect to SFS admin from my work PC no problem.

I see in the Login script in Unity there is an IP address hard coded as 127.0.0.1, do I need to modify that? I've tried that but the client always comes up with 127.0.0.1 in the login dialog.

I'm building FPS as a 64 bit Windows app.

Thoughts?

Kind regards,
Mark
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity FPS demo and external IP access

Postby Bax » 09 May 2012, 14:22

Yes, you have to change that 127.0.0.1 hardcoded in the client to the public IP of your router.
Paolo Bax
The SmartFoxServer Team
markypoos
Posts: 4
Joined: 09 May 2012, 01:14

Re: Unity FPS demo and external IP access

Postby markypoos » 10 May 2012, 01:08

Thanks, have already tried that of course, but noticed a couple of things that were a little interesting.

If you attempt to start the FPS client on a machine not running SFS server you get a connection error before being able to enter your login details, so it's like its trying to find the SFS server before you fill out the login form and click LOGIN button.

The server name box on the login form always comes up with 127.0.0.1 despite what you set the servername variable to in the login script code. I can't see where it is getting 127.0.0.1 from.

I know the build function is working as I can put a loginname in the login script and that comes through after a rebuild instead of a blank on the login form, but the servername is always 127.0.0.1 no matter what I try in the servername field.

I don't know the Unity IDE very well so is it possible the 127.0.0.1 is set as a property on the field on a "form" somewhere, although looking at the code it looks like it creates the "form" on the fly and hence has no IDE accessable properties.

Kind regards,
Mark
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity FPS demo and external IP access

Postby Bax » 11 May 2012, 06:56

Sorry but... why don't you simply enter the right IP in the box before clicking the Login button?
Paolo Bax
The SmartFoxServer Team
markypoos
Posts: 4
Joined: 09 May 2012, 01:14

Re: Unity FPS demo and external IP access

Postby markypoos » 11 May 2012, 20:31

That's what I do and it throws the two User Does Not Exist errors into the log.

Mark
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity FPS demo and external IP access

Postby Bax » 14 May 2012, 08:21

I believe you have some issue with the UDP connection. In the Server Configurator module of the Admin Tool did you bind the right IPs, ports and protocols?
Paolo Bax
The SmartFoxServer Team
markypoos
Posts: 4
Joined: 09 May 2012, 01:14

Re: Unity FPS demo and external IP access

Postby markypoos » 15 May 2012, 00:57

I've bound 192.168.0.4 UDP and TCP for port 9133 as the only socket address. ie. I removed 127.0.0.1

My router port forwards 9133 TCP and UDP to this IP address, along with port 8080 for admin, which works fine over the internet. I can admin SFS fine from work.

In the IP filter tab I've removed all whitelist entries, and left 1.2.3.4 in the blacklist, and left the IP filter number of connections as 9999999

Anything else I needed to change?

Kind regards
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Unity FPS demo and external IP access

Postby Bax » 15 May 2012, 08:10

Are you sure the example is connecting to the right ports? (both TCP and UDP)?
Also, just to make sure... are you using the latest version of the API, available on this page: http://www.smartfoxserver.com/download/sfs2x#p=updates
Paolo Bax
The SmartFoxServer Team
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Re: Unity FPS demo and external IP access

Postby ThomasLund » 17 May 2012, 15:00

The server name box on the login form always comes up with 127.0.0.1 despite what you set the servername variable to in the login script code. I can't see where it is getting 127.0.0.1 from.


Unity has this nice/nasty habbit of overriding script public variables if they are available in the inspector. You need to open the login scene, click the LoginGUI game object and change the IP address in the inspector for it to work. Any changes in your scripts are disregarded as said.

For the issues with firewalls - always a bitch... Unsure how to help on that

/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 40 guests