Search code examples
javacloud-hostingserversocket

Using other ports on CloudBees


I'm trying to write a multiplayer realtime game and run it on CloudBees (the client side is an applet, the server side a java web application). Is it possible to give the server permission to listen on another port? (ie so the server-side code can create a ServerSocket on that port and the client side code can create a Socket to connect and communicate with the server)


Solution

  • Whilst it may be possible it is quite tricky as the available port is likely to change as your app moves around. On top of this - you would need to locate the address of the instance of where your app is running (ie some kind of dynamic directory) - so kind of fiddly. The web routing layer does all this for you - but presumes http or similar (you can use "long poll" and keep a connection open from an applet - this could work in a similar way, with some work).