one application can have two listener port?

Options
ymlyjq
edited September 2013 in Photon Server
in my application , like lite sample

i what have two listener port to listen two different type connections ;

but i dont known how to do

loadbalance has two ,but it is different;
[code2=xml]<UDPListeners>
<UDPListener
IPAddress="0.0.0.0"
Port="5055"
OverrideApplication="Master">
</UDPListener>
<UDPListener
IPAddress="0.0.0.0"
Port="5056"
OverrideApplication="Game1">
</UDPListener>
</UDPListeners>[/code2]
up config has two port , but it means two different appliactions,
and
what is means obout "OverrideApplication="Master""
[code2=xml]<!-- Port 5055 is Photon's default for UDP connections. -->
<UDPListeners>
<UDPListener
IPAddress="0.0.0.0"
Port="5055">
</UDPListener>
</UDPListeners>[/code2]

Comments

  • chvetsov
    Options
    Hi, ymlyjq.
    In general, connector like this
    <UDPListener
    IPAddress="0.0.0.0"
    Port="5055">

    means that Photon listens port 5055 on UDP protocol on all interfaces. You may add many such connectors with differnt ports on different intefaces. And then Photon will open and listen all this ports. And it is up to you how this ports are used.

    if you add OverrideApplication attribute, then this application name will be used when someone connects to this port. This application name overrides name, which was sent by user. Well, yes, in this case we could say that this connector belongs to this application.

    if you need many connectors you just need to add many entries like this
    <UDPListener
    IPAddress="0.0.0.0"
    Port="5055"/>
    <UDPListener
    IPAddress="0.0.0.0"
    Port="5056"/>
    <UDPListener
    IPAddress="0.0.0.0"
    Port="5057"/>
    <UDPListener
    IPAddress="0.0.0.0"
    Port="5058"/>

    You may add OverrideApplication attribute to any of this connectors
    <UDPListener
    IPAddress="0.0.0.0"
    Port="5059"
    OverrideApplication="Game1">
    <UDPListener
    IPAddress="0.0.0.0"
    Port="5060"
    OverrideApplication="Game1">
    and so on
  • thanks ,
    but no success!
    [code2=xml]<TCPListeners>
    <TCPListener
    IPAddress="0.0.0.0"
    Port="4530">
    </TCPListener>
    </TCPListeners>

    <TCPListeners>
    <TCPListener
    IPAddress="192.168.1.2" //or 0.0.0.0
    Port="4531">
    </TCPListener>
    or
    <TCPListeners>
    <TCPListener
    IPAddress="192.168.1.2" //or 0.0.0.0
    Port="4531"
    OverrideApplication="ManagerServer">
    </TCPListener>
    </TCPListeners>[/code2]

    then i use cmd netstat -anon|findstr "4531" , none ,that means the 4531 port not open,why ?
    what am i missing ?

    my ask is about one application has two listern port ....
      <TCPListeners> <TCPListener IPAddress="0.0.0.0" Port="4530" OverrideApplication="LoginServer"> </TCPListener> </TCPListeners> <TCPListeners> <TCPListener IPAddress="0.0.0.0" Port="4531" OverrideApplication="LoginServer"> </TCPListener> </TCPListeners> <Application Name="LoginServer" BaseDirectory="LiteLobby" Assembly="LoginServer" Type="LoginServer.LoginServerApp" ForceAutoRestart="true" WatchFiles="dll;config" ExcludeFiles="log4net.config"> </Application>
      5900: 13:30:39.070 - Adding TCP listener on :0.0.0.0: 4530 with a listen backlog of: 150 5900: 13:30:39.070 - TCP inactivity timeout: 5000ms 5900: 13:30:39.070 - TCP disconnect timeout: 120000ms 5900: 13:30:39.070 - MaxInboundMessageSize: 512000 5900: 13:30:39.070 - MaxOutboundMessageSize: 512000 5900: 13:30:39.070 - Forcing all applications ids to: "LoginServer" 5900: 13:30:39.070 - Forcing all applications ids to: "LoginServer" 5900: 13:30:39.070 - MaxInboundMessageSize: 512000 5900: 13:30:39.070 - MaxOutboundMessageSize: 512000 5900: 13:30:39.070 - UDP address specified as:0.0.0.0 adding listener to each available IPv4 address 5900: 13:30:39.070 - Adding UDP listener on :192.168.1.2: 5055 with a listen backlog of: 500 5900: 13:30:39.070 - Adding UDP listener on :127.0.0.1: 5055 with a listen backlog of: 500 5900: 13:30:39.080 - Service is running...

    no 4531 run message....
  • and other test....

    one dll as loginserver has two application like

    namespace LoginServer.GameServer
    public class ListenGameApp : ApplicationBase

    namespace LoginServer
    public class LoginServerApp : ApplicationBase

    and then photonserver.config like:
      <?xml version="1.0" encoding="Windows-1252"?> <Configuration> <Default MaxMessageSize="512000" MaxQueuedDataPerPeer="512000" PerPeerMaxReliableDataInTransit="51200" PerPeerTransmitRateLimitKBSec="256" PerPeerTransmitRatePeriodMilliseconds="200" MinimumTimeout="20000" MaximumTimeout="40000"> <UDPListeners> <UDPListener IPAddress="0.0.0.0" Port="5055" OverrideApplication="LoginServer"> </UDPListener> </UDPListeners> <UDPListeners> <UDPListener IPAddress="0.0.0.0" Port="5056" OverrideApplication="ListenServer"> </UDPListener> </UDPListeners> <TCPListeners> <TCPListener IPAddress="0.0.0.0" Port="4530" OverrideApplication="LoginServer"> </TCPListener> </TCPListeners> <TCPListeners> <TCPListener IPAddress="0.0.0.0" Port="4531" OverrideApplication="ListenServer"> </TCPListener> </TCPListeners> <!-- Defines the Photon Runtime Assembly to use. --> <Runtime Assembly="PhotonHostRuntime, Culture=neutral" Type="PhotonHostRuntime.PhotonDomainManager" UnhandledExceptionPolicy="Ignore"> </Runtime> <Applications Default="LoginServer"> <!-- LoginServer Application --> <Application Name="LoginServer" BaseDirectory="LiteLobby" Assembly="LoginServer" Type="LoginServer.LoginServerApp" ForceAutoRestart="true" WatchFiles="dll;config" ExcludeFiles="log4net.config"> </Application> <!-- ListenServer Application --> <Application Name="ListenServer" BaseDirectory="LiteLobby" Assembly="LoginServer" Type="LoginServer.GameServer.ListenGameApp" ForceAutoRestart="true" WatchFiles="dll;config" ExcludeFiles="log4net.config"> </Application> <!-- Lite Application --> <Application Name="Lite" BaseDirectory="Lite" Assembly="Lite" Type="Lite.LiteApplication" ForceAutoRestart="true" WatchFiles="dll;config" ExcludeFiles="log4net.config"> </Application> <!-- LiteLobby Application --> <Application Name="LiteLobby" BaseDirectory="LiteLobby" Assembly="LiteLobby" Type="LiteLobby.LiteLobbyApplication" ForceAutoRestart="true" WatchFiles="dll;config" ExcludeFiles="log4net.config"> </Application> </Applications> </Default> </Configuration>

    and no 4531 port opened , what was wrong with me?
  • chvetsov
    Options
    Please, use <TCPListeners> only once. and inside of this tag many <TCPListener>

    <TCPListeners>
    <TCPListener
    IPAddress="0.0.0.0"
    Port="4530"
    OverrideApplication="LoginServer">
    </TCPListener>

    <TCPListener
    IPAddress="0.0.0.0"
    Port="4531"
    OverrideApplication="LoginServer">
    </TCPListener>

    </TCPListeners>

    this should help