Was not able to bind socket for my public IP

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

Moderators: Lapo, Bax

Post Reply
Anatoli
Posts: 10
Joined: 12 Jul 2011, 02:31

Was not able to bind socket for my public IP

Post by Anatoli »

Hi everyone,

I'm fairly new to smartfox and recently I encountered a problem that I can't solve :(

For some reason sfs binds sockets for my private and local IP with no problems, but can't bind a socket for my public IP, and therefore I can't connect to my server from different computers.

First I created inbound and outbound rules for the firewall to let sfs use any ports and it didn't work. Then I shut down my firewall completely, but the problem remains the same.

I tried to telnet my public IP, and I can't connect, which means that nothing is running on this port.

Here is the boot log of the server:


13 Jul 2011 12:41:52,302 INFO [main] bootLogger - SmartFoxServer 2X
13 Jul 2011 12:41:52,305 INFO [main] bootLogger - BitSwarmEngine version: 3.3.1 { main }
13 Jul 2011 12:41:52,307 INFO [main] bootLogger - System Info:
Processor(s): 2
VM Max. memory: 932MB
os.name: Windows 7
os.arch: amd64
os.version: 6.1
java.version: 1.6.0_21
java.vendor: Sun Microsystems Inc.
java.vendor.url: http://java.sun.com/
java.vm.specification.version: 1.0
java.vm.version: 17.0-b16
java.vm.vendor: Sun Microsystems Inc.
java.vm.name: Java HotSpot(TM) 64-Bit Server VM
java.io.tmpdir: C:\Windows\TEMP\
Default charset: UTF-8

13 Jul 2011 12:41:52,315 INFO [main] bootLogger - Network Info:
Card: Software Loopback Interface 1
->0:0:0:0:0:0:0:1
->127.0.0.1
Card: WAN Miniport (SSTP)
Card: WAN Miniport (L2TP)
Card: WAN Miniport (PPTP)
Card: WAN Miniport (PPPOE)
Card: WAN Miniport (IPv6)
Card: WAN Miniport (Network Monitor)
Card: WAN Miniport (IP)
Card: RAS Async Adapter
Card: Realtek PCIe FE Family Controller
->192.168.1.24
Card: Microsoft 6to4 Adapter
Card: Intel(R) WiFi Link 1000 BGN
Card: Teredo Tunneling Pseudo-Interface
->2001:0:4137:9e76:45d:15de:b7a0:829
->fe80:0:0:0:45d:15de:b7a0:829%13
Card: Bluetooth Device (RFCOMM Protocol TDI)
Card: Bluetooth Device (Personal Area Network)
Card: Microsoft Virtual WiFi Miniport Adapter
Card: Microsoft ISATAP Adapter
->fe80:0:0:0:0:5efe:c0a8:118%17
Card: Microsoft ISATAP Adapter #2
Card: Microsoft ISATAP Adapter #3
Card: WAN Miniport (IKEv2)
Card: Realtek PCIe FE Family Controller-QoS Packet Scheduler-0000
Card: Realtek PCIe FE Family Controller-WFP LightWeight Filter-0000
Card: WAN Miniport (IPv6)-QoS Packet Scheduler-0000
Card: WAN Miniport (IP)-QoS Packet Scheduler-0000
Card: WAN Miniport (Network Monitor)-QoS Packet Scheduler-0000

13 Jul 2011 12:41:52,321 INFO [main] bootLogger - Session manager ready: com.smartfoxserver.bitswarm.sessions.DefaultSessionManager@3961b9b2
13 Jul 2011 12:41:52,329 INFO [main] bootLogger - ReaderSelector opened
13 Jul 2011 12:41:52,341 INFO [main] bootLogger - AcceptSelector opened
13 Jul 2011 12:41:52,344 INFO [main] bootLogger - Added bound tcp socket --> 127.0.0.1:9933
13 Jul 2011 12:41:52,345 INFO [main] bootLogger - Added bound tcp socket --> 127.0.0.1:5151
13 Jul 2011 12:41:52,345 INFO [main] bootLogger - Added bound tcp socket --> 192.168.1.24:5151
13 Jul 2011 12:41:52,346 WARN [main] bootLogger - Was not able to bind socket: { 72.95.247.214:5151, (Tcp) }
13 Jul 2011 12:41:52,347 INFO [main] bootLogger - Controller started: com.smartfoxserver.v2.controllers.SystemController -- Queue: 0/20000
13 Jul 2011 12:41:52,348 INFO [main] bootLogger - Controller started: com.smartfoxserver.v2.controllers.ExtensionController -- Queue: 0/20000
13 Jul 2011 12:41:52,348 INFO [main] bootLogger - IOHandler: com.smartfoxserver.v2.protocol.SFSIoHandler@430ef1aa
13 Jul 2011 12:41:52,348 INFO [main] bootLogger - SocketReader started
13 Jul 2011 12:41:52,349 INFO [main] bootLogger - SocketAcceptor initialized
13 Jul 2011 12:41:52,349 INFO [main] bootLogger - Socket Writer started (pool size:1)
13 Jul 2011 12:41:52,349 INFO [Scheduler1-thread-1] bootLogger - Scheduler started: scheduler
13 Jul 2011 12:41:52,350 INFO [main] bootLogger - Security Manager started
13 Jul 2011 12:41:52,353 INFO [main] bootLogger - [[[ ===--- Boot sequence complete ---=== ]]]
13 Jul 2011 12:47:33,293 INFO [main] bootLogger - SmartFoxServer 2X
13 Jul 2011 12:47:33,296 INFO [main] bootLogger - BitSwarmEngine version: 3.3.1 { main }
13 Jul 2011 12:47:33,297 INFO [main] bootLogger - System Info:
Processor(s): 2
VM Max. memory: 932MB
os.name: Windows 7
os.arch: amd64
os.version: 6.1
java.version: 1.6.0_21
java.vendor: Sun Microsystems Inc.
java.vendor.url: http://java.sun.com/
java.vm.specification.version: 1.0
java.vm.version: 17.0-b16
java.vm.vendor: Sun Microsystems Inc.
java.vm.name: Java HotSpot(TM) 64-Bit Server VM
java.io.tmpdir: C:\Windows\TEMP\
Default charset: UTF-8

13 Jul 2011 12:47:33,308 INFO [main] bootLogger - Network Info:
Card: Software Loopback Interface 1
->0:0:0:0:0:0:0:1
->127.0.0.1
Card: WAN Miniport (SSTP)
Card: WAN Miniport (L2TP)
Card: WAN Miniport (PPTP)
Card: WAN Miniport (PPPOE)
Card: WAN Miniport (IPv6)
Card: WAN Miniport (Network Monitor)
Card: WAN Miniport (IP)
Card: RAS Async Adapter
Card: Realtek PCIe FE Family Controller
->192.168.1.24
Card: Microsoft 6to4 Adapter
Card: Intel(R) WiFi Link 1000 BGN
Card: Teredo Tunneling Pseudo-Interface
->2001:0:4137:9e76:45d:15de:b7a0:829
->fe80:0:0:0:45d:15de:b7a0:829%13
Card: Bluetooth Device (RFCOMM Protocol TDI)
Card: Bluetooth Device (Personal Area Network)
Card: Microsoft Virtual WiFi Miniport Adapter
Card: Microsoft ISATAP Adapter
->fe80:0:0:0:0:5efe:c0a8:118%17
Card: Microsoft ISATAP Adapter #2
Card: Microsoft ISATAP Adapter #3
Card: WAN Miniport (IKEv2)
Card: Realtek PCIe FE Family Controller-QoS Packet Scheduler-0000
Card: Realtek PCIe FE Family Controller-WFP LightWeight Filter-0000
Card: WAN Miniport (IPv6)-QoS Packet Scheduler-0000
Card: WAN Miniport (IP)-QoS Packet Scheduler-0000
Card: WAN Miniport (Network Monitor)-QoS Packet Scheduler-0000

13 Jul 2011 12:47:33,316 INFO [main] bootLogger - Session manager ready: com.smartfoxserver.bitswarm.sessions.DefaultSessionManager@10c767b1
13 Jul 2011 12:47:33,326 INFO [main] bootLogger - ReaderSelector opened
13 Jul 2011 12:47:33,337 INFO [main] bootLogger - AcceptSelector opened
13 Jul 2011 12:47:33,340 INFO [main] bootLogger - Added bound tcp socket --> 127.0.0.1:9933
13 Jul 2011 12:47:33,341 INFO [main] bootLogger - Added bound tcp socket --> 127.0.0.1:5151
13 Jul 2011 12:47:33,341 INFO [main] bootLogger - Added bound tcp socket --> 192.168.1.24:5151
13 Jul 2011 12:47:33,341 WARN [main] bootLogger - Was not able to bind socket: { 72.95.247.214:5151, (Tcp) }
13 Jul 2011 12:47:33,343 INFO [main] bootLogger - Controller started: com.smartfoxserver.v2.controllers.SystemController -- Queue: 0/20000
13 Jul 2011 12:47:33,343 INFO [main] bootLogger - Controller started: com.smartfoxserver.v2.controllers.ExtensionController -- Queue: 0/20000
13 Jul 2011 12:47:33,344 INFO [main] bootLogger - IOHandler: com.smartfoxserver.v2.protocol.SFSIoHandler@1676fe3a
13 Jul 2011 12:47:33,344 INFO [main] bootLogger - SocketReader started
13 Jul 2011 12:47:33,344 INFO [main] bootLogger - SocketAcceptor initialized
13 Jul 2011 12:47:33,345 INFO [main] bootLogger - Socket Writer started (pool size:1)
13 Jul 2011 12:47:33,345 INFO [Scheduler1-thread-1] bootLogger - Scheduler started: scheduler
13 Jul 2011 12:47:33,346 INFO [main] bootLogger - Security Manager started
13 Jul 2011 12:47:33,348 INFO [main] bootLogger - [[[ ===--- Boot sequence complete ---=== ]]]


Please let me know what I am doing wrong. Any help will be greatly appreciated!
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

You can bind to all IPs listed in the AdminTool's Server Configurator.
You then have to configure the router to redirect the traffic from the public (router) IP to the private one.
Paolo Bax
The SmartFoxServer Team
Anatoli
Posts: 10
Joined: 12 Jul 2011, 02:31

Post by Anatoli »

bax, thank you for your input.

My question will probably sound stupid, but I'm new to all this and apparently I don't know some obvious things.

I am setting up the smartfox server at home, and I don't even know where the router which assigned my private IP is located. So I am not quite sure how I can configure the router to redirect the traffic from the public IP to my private IP. I tried serching the internet for it, but couldn't find anything that would seem useful for me.

However, I tried adding a new route in command prompt by inputting:

route ADD 72.95.247.214 MASK 255.255.255.255 192.168.1.24

and this new route appeared then in my routing table:

IPv4 Route Table
===============================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.24 20
72.95.247.214 255.255.255.255 On-link 192.168.1.24 21
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
192.168.1.0 255.255.255.0 On-link 192.168.1.24 276
192.168.1.24 255.255.255.255 On-link 192.168.1.24 276
192.168.1.255 255.255.255.255 On-link 192.168.1.24 276
224.0.0.0 240.0.0.0 On-link 127.0.0.1 306
224.0.0.0 240.0.0.0 On-link 192.168.1.24 276
255.255.255.255 255.255.255.255 On-link 127.0.0.1 306
255.255.255.255 255.255.255.255 On-link 192.168.1.24 276
===============================================

But the smatfoxserver still can't bind the socket for my public IP.
Can you tell me what I'm doing wrong?
Or if the way I'm doing it is completely wrong can you at least give me an idea of what to search for in the internet, because I feel like I'm completely lost now :(
Thank you in advance.
jurekf
Posts: 69
Joined: 08 Dec 2010, 23:46

Post by jurekf »

It's possible you're on a NAT and your public IP is not actually yours but shared among a subnet. In that case, your machine cannot be a publicly visible server without you talking to your ISP and have them redirect a port to you specifically.
Anatoli
Posts: 10
Joined: 12 Jul 2011, 02:31

Post by Anatoli »

jurekf, thanks, you were right,

I did some research on my ISP and figured out the way I can configure the forwarding on my router. I just have to go to http://192.168.1.1/ and with my username and password I can make rules for port forwardings.

However, I already tried creating many different rules for it, but I still have no luck :(
I still can't even telnet my public IP (72.95.247.214) on the port that I'm trying to bind (5151).
It tells me that I can't connect.

Maybe you guys can help me figure out what I have to put into the fields here to make a working forwarding rule to my LAN IP:
Protocol: TCP
Global PortStart: ?
Global PortEnd: ?
Base HostPort: ?
Direction: IN/OUT?
Port Direction: DST/SRC?
LAN IP: 192.168.1.24

I tried putting different port numbers into these fields, but I think I'm doing something wrong.

And also, after making this rule, to establish the connection with my smartfoxserver, is it enough for me to bind in server configuration just 127.0.0.1:5151 and 192.168.1.24:5151, or I have to bind my public IP somehow too?

Thanks for your help.
Anatoli
Posts: 10
Joined: 12 Jul 2011, 02:31

Post by Anatoli »

Hi, I'm still working on this issue and cannot resolve it.

I tried setting up forwarding, and now online checkers are saying that they can successfully connect to my service on port 5151, but I still can't even connect to that public IP using the SimpleChat example. And I cant telnet it for some reason too.

I would be glad to get some help on it.

PS. Is it fine that I can connect to my smartfox admit tool only using port 9933, even though I did bind a couple more ports on the same local IP?(127.0.0.1) I cannot connect to any of them, except the default 9933.
Anatoli
Posts: 10
Joined: 12 Jul 2011, 02:31

Post by Anatoli »

Hello? Anyone? :(
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

By default the examples use an external configuration file which points to 127.0.0.1. So make sure you change it to the public IP of your server.
About the AdminTool, maybe you have SFS configured to accept admin connections from port 9933 only. Check the Server Configurator module.
Paolo Bax
The SmartFoxServer Team
Anatoli
Posts: 10
Joined: 12 Jul 2011, 02:31

Post by Anatoli »

Thanks for the reply, bax

Now can connect to the admin tool using different ports.

But with connections I still have a small problem.

I am running smartfox server on my computer with public IP: 72.95.247.214 and the clients can easily connect to this server from different computers (finally I set up the router right).

However, for some reason I cannot connect my own computer to this server when I'm trying to connect to my public IP.
I can only connect to the server using my local IP.

I feel like I should be able to connect to it using my public IP too, or am I wrong?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Not sure, but you might be wrong. If you connect locally (SFS running on the same computer), use 127.0.0.1.
Paolo Bax
The SmartFoxServer Team
Anatoli
Posts: 10
Joined: 12 Jul 2011, 02:31

Post by Anatoli »

Yes, that is what I am trying to ask.

When I connect locally and use 127.0.0.1 everything connects and works well,
but when I use 72.95.247.214 - it doesn't connect. And it probably shouldn't work anyways since I connect locally, am I right?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

You are right. As you are connecting locally, I think it doesn't pass through the router.
Paolo Bax
The SmartFoxServer Team
Anatoli
Posts: 10
Joined: 12 Jul 2011, 02:31

Post by Anatoli »

OK, I did some more research on it and now I finally figured everything out.

I cannot connect to my own public IP just because my router does not support reverse path forwarding (RPF).
That is why I can only connect to my own server using my local IP or my private IP.

Now I know what was the problem.

Thanks everyone for replies.
Post Reply