embedded http server port? how to get?

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

Moderators: Lapo, Bax

rav
Posts: 82
Joined: 06 Dec 2010, 13:14

embedded http server port? how to get?

Postby rav » 29 Sep 2011, 12:19

Is there a way to get port of embedded http server from code? My load balancers should send to clients data about alive game servers in cluster: ip, port and httpPort (is blurBox is enable).

It'll be great if there will be method "getHttpPort()" in com.smartfoxserver.v2.http.IHttpServer class
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 30 Sep 2011, 08:13

At the moment no, but we're adding it in the next release
For now the only way is to parse the config/jetty.xml file.

It can be done easily:
Open the file with the FileUtils class included in the Apache commons library included in SFS2X
Then look for this line:

Code: Select all

<SystemProperty name="jetty.port" default="8080"/>

You can search the "jetty.port" ID and then grab the port with a bit of String manipulation

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
rav
Posts: 82
Joined: 06 Dec 2010, 13:14

Postby rav » 30 Sep 2011, 12:07

Reading jetty.xml is a bit crooked, but it's the only way :)
Waiting for new release

Thank you

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 135 guests