ServerToServer problem

Options
oman
oman
edited December 2012 in Photon Server
I create two project to text the ServerToServer , in one project, the subserver node(A) can connect to another server node B(all of them are NodeResolverBase application) but the A server's CreateServerPeer callback was called, but the B Server's OnNodeConnected callback method wasn't called, what's the problem?

in another project, the when the subserver connect to another subserver, it failed, and the error message is Disconnect, I check with netstat and found that the tcp port was not setup, but in the previous project, the same tcp port can be setup, the above two problem confused me very much, I need your help urgently.

Comments

  • Philip
    Options
    Don't use the NodeResolverBase - it's not thought for that usage (the class is there for historical reasons and will ev. be removed).

    When Node A connects Node B - you should see a "normal" CreatePeer(..) call on Node B. There is nothing in Photon
    to "see" that it is a Server connecting - its up to you to figure that out.

    To see how we do that in Loadbalancing check the code in the MasterApplication:

    [code2=csharp]protected override PeerBase CreatePeer(InitRequest initRequest)
    {
    if (this.IsGameServerPeer(initRequest))
    {
    if (log.IsDebugEnabled)
    {
    log.DebugFormat("Received init request from game server");
    }

    return new IncomingGameServerPeer(initRequest, this);
    }

    if (this.LocalNodeId == this.MasterNodeId)
    {
    if (log.IsDebugEnabled)
    {
    log.DebugFormat("Received init request from game client on leader node");
    }

    return new MasterClientPeer(initRequest, this.Lobby);
    }

    if (log.IsDebugEnabled)
    {
    log.DebugFormat("Received init request from game client on slave node");
    }

    return new RedirectedClientPeer(initRequest.Protocol, initRequest.PhotonPeer, this);
    }[/code2]
  • Philip
    Options
    For your connectivity issues check

    1) on node B - PhotonServer.config has a TcpListener <your-port>.

    2) on node B: start Photon & telnet localhost <your-port> ... if it refuses to connect your Photon config is wrong.

    3) telnet <ip-address-of-node-A> <your-port> ... assuming 2) worked and now it refuses to connect - you have a firewall problem.
    Note: i'm assuming you can access node B from node A by other means ...
  • oman
    Options
    I remove NodeResolveBase and replace with ApplicationBase , the problem is still there, telnet can connect to the port, and the firewall is closed, on node B, CreatePeer is called, but on node a, the CreateServerPeer was not called. oh my god, Headache I die
  • Philip
    Options
    Hi oman,

    sorry 3) should have been
    On node A: telnet <ip-address-of-node-B> <your-port>

    What do you get if you do that? Does it work?
  • oman
    Options
    Yes, acturally I test telnet <ip of node B><node B tcp port>, and it work properly.
  • Philip
    Options
    Here you can find a small test application https://dl.dropbox.com/u/4294951/S2STest.zip.

    See if it works for you - its an app that connects to our standard Photon Instance "Default" (the Lite Application):
    On Node A
    1) copy the included {S2STest.zip}\Lite\log4net.config to {sdk}\deploy\Lite\bin
    2) start Photon Default Instance

    On Node B
    3) in {S2STest.zip}\S2STest\MyApplication.cs set the <ip-of-node-A>:
    var otherServerIp = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("127.0.0.1"), 4530);
    4) start Photon with S2STest

    The log of Lite on node A should look like this:
    2012-11-29 16:01:17,946 &#91;1&#93; INFO  Lite.LiteApplication &#91;(null)&#93; - Created application Instance: type=Lite.LiteApplication
    2012-11-29 16:01:17,992 &#91;1&#93; INFO  Photon.SocketServer.ApplicationBase &#91;(null)&#93; - Application start: AppId=Lite; AppPath=C:\Data\src\photon-socketserver-sdk\deploy\Lite, Type=Lite.LiteApplication 
    2012-11-29 16:01:18,008 &#91;1&#93; INFO  Photon.SocketServer.Diagnostics.CounterPublisher &#91;(null)&#93; - CounterPublisher started on: 255.255.255.255:40001
    2012-11-29 16:01:33,653 &#91;8&#93; DEBUG OperationData &#91;(null)&#93; - OnInit - ConnID=2, data=(41 bytes) F3-00-01-06-01-03-00-05-07-4C-69-74-65-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
    2012-11-29 16:01:33,655 &#91;8&#93; DEBUG Photon.SocketServer.ApplicationBase &#91;(null)&#93; - OnInit - ConnID=2, IP 127.0.0.1 on port 4530
    2012-11-29 16:01:33,662 &#91;8&#93; DEBUG Photon.SocketServer.Protocol &#91;(null)&#93; - Parsed init message for application Lite, client version 3.0.5, protocol GpBinaryV2 version 1.6
    2012-11-29 16:01:33,669 &#91;8&#93; DEBUG Photon.SocketServer.ApplicationBase &#91;(null)&#93; - OnInit - response sent to ConnId 2 with SendResult Ok
    2012-11-29 16:01:33,670 &#91;8&#93; DEBUG OperationData &#91;(null)&#93; - OnInit - ConnID=2, send data=(3 bytes) F3-01-00
    

    The log of S2STest on node B should look like this:
    2012-11-29 15:59:13,052 &#91;1&#93; DEBUG S2STest.MyApplication &#91;(null)&#93; - Setup ... 
    2012-11-29 15:59:13,067 &#91;1&#93; INFO  Photon.SocketServer.ApplicationBase &#91;(null)&#93; - Application start: AppId=S2STest; AppPath=C:\Data\src\photon-socketserver-sdk\src-server\S2STest\S2STest, Type=S2STest.MyApplication 
    2012-11-29 15:59:13,067 &#91;16&#93; DEBUG Photon.SocketServer.ServerToServer.TemporaryServerPeer &#91;(null)&#93; - OnOutboundConnectionEstablished: sending init request
    2012-11-29 15:59:13,079 &#91;16&#93; DEBUG OperationData &#91;(null)&#93; - SentInitRequest: ConnID=2, ChannelId=0, result=Ok, data=(41 bytes) F3-00-01-06-01-03-00-05-07-4C-69-74-65-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
    2012-11-29 15:59:13,104 &#91;16&#93; DEBUG OperationData &#91;(null)&#93; - OnReceive - ConnID=2, data=(3 bytes) F3-01-00
    2012-11-29 15:59:13,107 &#91;16&#93; DEBUG S2STest.MyApplication &#91;(null)&#93; - CreateServerPeer ... 127.0.0.1:3385 connected to 127.0.0.1:4530
    2012-11-29 16:01:33,621 &#91;1&#93; DEBUG S2STest.MyApplication &#91;(null)&#93; - Setup ... 
    2012-11-29 16:01:33,635 &#91;1&#93; INFO  Photon.SocketServer.ApplicationBase &#91;(null)&#93; - Application start: AppId=S2STest; AppPath=C:\Data\src\photon-socketserver-sdk\src-server\S2STest\S2STest, Type=S2STest.MyApplication 
    2012-11-29 16:01:33,635 &#91;17&#93; DEBUG Photon.SocketServer.ServerToServer.TemporaryServerPeer &#91;(null)&#93; - OnOutboundConnectionEstablished: sending init request
    2012-11-29 16:01:33,647 &#91;17&#93; DEBUG OperationData &#91;(null)&#93; - SentInitRequest: ConnID=2, ChannelId=0, result=Ok, data=(41 bytes) F3-00-01-06-01-03-00-05-07-4C-69-74-65-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
    2012-11-29 16:01:33,672 &#91;17&#93; DEBUG OperationData &#91;(null)&#93; - OnReceive - ConnID=2, data=(3 bytes) F3-01-00
    2012-11-29 16:01:33,675 &#91;17&#93; DEBUG S2STest.MyApplication &#91;(null)&#93; - CreateServerPeer ... 127.0.0.1:3416 connected to 127.0.0.1:4530
    
  • xzlxt720
    Options
    mark