TCPSocketLayer: Connection error

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

kosirm
Posts: 11
Joined: 01 Mar 2006, 22:08

TCPSocketLayer: Connection error

Postby kosirm » 03 Sep 2010, 11:32

Hi,

I'm running Smartfox2 server on EC2 Windows instance, it all works fine locally, but can't acces it from outside. I remember the same problem with Smartfox 1 which was never solved.
I've opened tcp and udp ports (9933, 843 and 943) on windows firewall (inbound rule), I've opened ports on ec2 security groups, I've also put cross-domain file on root even if I run unity example, not flash ... I don't know what more to do. I've spended whole week trying different solutions, nothing helps, connection is refused . Can somebody please help ?
Thanks in advance for any reply,
Milan

This is error:

[SFS DEBUG] TCPSocketLayer: Connection error: No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
at System.Net.Sockets.Socket.Connect (System.Net.IPAddress address, Int32 port) [0x00000] in <filename unknown>:0
at Sfs2X.Core.Sockets.TCPSocketLayer.ConnectThread () [0x00000] in <filename unknown>:0
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 03 Sep 2010, 14:16

Just wanted to chime in that I have no experience with neither EC2 or SFS(1/2) on Windows. So cant help.

Someone else?
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Sep 2010, 15:39

Running SmartFox on Windows is essentially the same thing as running it on any other OS. And EC2 shouldn't create any particular problems, it's just an hosting environment.

Also I don't understand this:
I remember the same problem with Smartfox 1 which was never solved.

Sorry, which problem exactly?

For starters make sure to be able to reach SmartFox via a normal telnet session. Start a new Windows console and type:
telnet <address> <port>

If there's a connection error then you have a problem with your firewall either on the client or server side.
Lapo
--
gotoAndPlay()
...addicted to flash games
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 04 Sep 2010, 08:33

Lapo wrote:Running SmartFox on Windows is essentially the same thing as running it on any other OS. And EC2 shouldn't create any particular problems, it's just an hosting environment.


Oh yeah - but it has its own security mechanisms in place most likely compared to Unix and OSX which I'm more used to. Java is java.

I'm certain that this is primarily a matter of security layers between your client and the server - not the server or client themselves.

Also - I've never heard about this problem before with SFS1. Was it reported?
kosirm
Posts: 11
Joined: 01 Mar 2006, 22:08

Postby kosirm » 06 Sep 2010, 09:41

Lapo wrote:Running SmartFox on Windows is essentially the same thing
Also I don't understand this:
I remember the same problem with Smartfox 1 which was never solved.

Sorry, which problem exactly?


It's my wrong expression - I never succeeded to run sf1 on ec2 because of connection problems, I didn't mean it was problem of smartfox in general. Sorry.
I'll run another instance and try to make telnet connection... thanks.
kosirm
Posts: 11
Joined: 01 Mar 2006, 22:08

Postby kosirm » 07 Sep 2010, 08:50

Ok, I've tried to make telnet connection with no success...
I've uploaded images here http://picasaweb.google.com/kosir.milan/Smartfox#
Please, if anybody can give me hint on what I'm doing wrong or what should I do more...
Thanks in advance for any reply,
Milan
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 07 Sep 2010, 09:17

Hi,
this should definitely be a simple firewall configuration issue.
in one of your images you say "Added windows firewall Inbound rule for smartfox on ec2 machine"

Make sure that the permissions are given to both directions of communication (incoming, outgoing) otherwise the communication won't take place.
Unfortunately I am no Windows Firewall expert so I don't have specific directions to offer. Maybe taking a look at the firewall docs will help
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 07 Sep 2010, 09:21

Sorry,
update on my previous post.
There is something "suspicious" in your config. In the last image you posted the server log shows that only 127.0.0.1:9933 is active in the server.

By default the server comes with only the localhost enabled.
In order to to run SFS2X on another IP address you will have to configure it by adding a new "connector" in the AdminTool -> Server Config.
Lapo

--

gotoAndPlay()

...addicted to flash games
kosirm
Posts: 11
Joined: 01 Mar 2006, 22:08

Postby kosirm » 07 Sep 2010, 09:44

Lapo, thanks a lot, I'm amazed with your support. Unfortunately I can see only zones, rooms and users in Admin tool. Please give a hint how to access Server Config in admin tool or how to add IP in server config xml maybe?
Thanks again,
Milan
stevets
Posts: 60
Joined: 11 Jul 2010, 12:22
Location: USA

Postby stevets » 07 Sep 2010, 09:52

kosirm wrote:Lapo, thanks a lot, I'm amazed with your support. Unfortunately I can see only zones, rooms and users in Admin tool. Please give a hint how to access Server Config in admin tool or how to add IP in server config xml maybe?
Thanks again,
Milan


Hi,

I followed Lapo's advice on my system on it works.

Update the socket choices in the admin tool.

Be sure to use your Lan IP address. It will bind the socket and show up in the log files. Then you can try Putty with the same Lan IP address.

Also, you should update to server version B14 to use the UDP capability. I see that your firewall is setup for it.

Hope it works.

Steve
kosirm
Posts: 11
Joined: 01 Mar 2006, 22:08

Postby kosirm » 07 Sep 2010, 11:10

Steve, thanks for reply, I'm happy for you, but I still can't connect. I've finally found Server config in Admin tool :oops:... (I've made this by hand in config file with same result)
but unfortunately smartfox can not bind sockets to IP in public dns... I've made a screenshot http://picasaweb.google.com/kosir.milan/Smartfox#5514130445682130914.
Amazon ec2 give you public dns(which is in form: ec2-<IP Address>.eu-west-1.compute.amazonaws.com) and private dns (which is in form: ip-<IP Address>.eu-west-1.compute.internal), if you run cmd and write ipconfig, you will see your private IP address, but it is of no use from outside world on ec2.
Any hint why sockets can't be binded to public dns?
Thanks in advance for reply,

Milan
stevets
Posts: 60
Joined: 11 Jul 2010, 12:22
Location: USA

Postby stevets » 07 Sep 2010, 12:14

RE: WARN [main] bootlogger - Was not able to bind socket: (79.125.117.165:9933), (Tcp) )

Is something else already bound to the socket? I think you will see this warning when that is the case.

Steve
kosirm
Posts: 11
Joined: 01 Mar 2006, 22:08

Postby kosirm » 07 Sep 2010, 12:59

Is something else already bound to the socket?


I can't imagine what...

Thanks,
Milan
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 07 Sep 2010, 13:10

I think there's still a problem. You are using the public IP address which is not physically available in your (even if virtual) machine. The public IP is mapped to your private IP address via a router that you don't even see or know about.

The private IP address is the one to use here.
How to discover the private IP? Simply run ifconfig in the terminal and you'll get a list of all addresses available. Usually you find just 2: the localhost (127.0.0.1) and the real network card address. That's the one you need.

The good news is that we are planning to simplify this process in the admin tool by adding a drop down that shows which addresses are bindable on your machine.

Coming in the next update :)
Lapo

--

gotoAndPlay()

...addicted to flash games
kosirm
Posts: 11
Joined: 01 Mar 2006, 22:08

Postby kosirm » 07 Sep 2010, 13:38

Thanks for reply,
as you can see (http://picasaweb.google.com/kosir.milan/Smartfox#5514130445682130914), I've binded all of them, localhost, private ip and public ip, and Smartfox is listening sockets on localhost and private ip. But I still can't connect to smartfox, because private IP on ec2 is for internal use only (you can use it only between ec2 nodes) as far as I understand.
Milan

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 57 guests