Page 1 of 1

server socket address

Posted: 04 Mar 2015, 07:38
by ramana
i want to know on which ip address server is running.
i found the code

import it.gotoandplay.smartfoxserver.config.ConfigData;

String ipAddr = ConfigData.SERVER_ADDR;
int port = ConfigData.SERVER_PORT;

My doubt is in which jar file this Class is available.


Thanks in advance

Re: server socket address

Posted: 04 Mar 2015, 10:18
by Lapo
Hi,
you have posted in the SmartFoxServer 2X question, but you're working with SmartFoxServer PRO, so I have moved your post.

ConfigData.SERVER_ADDR will return the address that is specified in the server's config.xml file.
My doubt is in which jar file this Class is available.
It's the main jysfs.jar.

Re: server socket address

Posted: 04 Mar 2015, 11:23
by ramana
Hi Lapo thank u for your reply. I am using smarrfox server 2X 2.7.1. in this only i want to get the socket address. please tell me the detailed process

Re: server socket address

Posted: 04 Mar 2015, 14:50
by Lapo
In SFS2X you can configure a number of socket listeners, this is the code to extract the list from the config:

Code: Select all

List<SocketAddress> adresses = SmartFoxServer.getInstance().getConfigurator().getServerSettings().socketAddresses;
Then you can extract the firs element from the list if you are using only one socket, or more if you have configured more of them.

The import for SocketAddress is --> com.smartfoxserver.v2.config.ServerSettings.SocketAddress