Access to listening port

edited November 2011 in Photon Server
I have an interesting desire here:

In PhotonServer.config we set the UDP and TCP ports for listening to specific servers. In code we have access to ApplicationName and BinaryPath. Is there any way we can get an accessor to the UDP or TCP listening ports?

My reasoning is that when I'm building a set of servers in a generic way, I can't hard code a value and have it work. By giving us a getter for that value, I can take it and pass it to other applications on the same server so they can connect.

Maybe there is already a way to get this that I am unaware of?

Christian - CJR Gaming


  • Right now it's not possible. We'll have an internal discussion about it.
  • Any word on whether this will be added? I've modified my framework to the point where i can make separate classes for each sub server, but that is ugly code duplication that I would rather have go away with the addition of these values.
  • We think this is a good feature and missing, so it will get into Photon in some way.
    We can't say when though.

    At the moment we try to finish up Photon 3 and document existing features.

    The only way to find an application's port is a peer's connection port (which won't help in your case).
    The Policy application is doing this:

    public void OnInit(IPhotonPeer peer, byte[] data) {
    byte[] bytes = peer.GetLocalPort() == 943 ? this.silverlightPolicyBytesUtf8 : this.policyBytesUtf8;
  • Yeah I resorted to the following in my concrete class:

    public override void Setup()
    { TcpPort = 4351; // etc }

    So for now I have it narrowed down.

    I look forward to seeing it added eventually.
  • Sorry for digging old topic. Is it possible to access listening port in Photon Server now?
  • hi, @nattawitta No, not yet. what kind of access do you need?

Sign In or Register to comment.