Failed to connect to server

vmarquisvmarquis
edited June 2015 in DotNet
Hello

I have an server on my local machine, the connection work fine on Unity by on a WPF application
PokerAdminClient.Instance.PokerAdminPeer.Connect("192.168.56.1:5055", "Master")
return false


Here are my class:
public class PokerAdminClient : IPhotonPeerListener
    {
        public static PokerAdminClient Instance
        {
            get { return _instance??(_instance=new PokerAdminClient()); }
            
        }

        public PokerAdminPeer PokerAdminPeer;
        private static PokerAdminClient _instance;

        public void DebugReturn(DebugLevel level, string message)
        {
            
        }


        private PokerAdminClient(ConnectionProtocol protocol = ConnectionProtocol.Udp)
        {

            
            this.PokerAdminPeer = new PokerAdminPeer(this, protocol);
        }
        public void OnOperationResponse(OperationResponse operationResponse)
        {
            switch (operationResponse.OperationCode)
            {
                case (byte) PokerOperationCode.MajStore:
                    HandleMajStore(operationResponse);
                    break;
            }
        }

        private void HandleMajStore(OperationResponse operationResponse)
        {
            MessageBox.Show(operationResponse.ReturnCode == 0 ? "Maj en cours" : operationResponse.DebugMessage);
        }

        public void OnStatusChanged(StatusCode statusCode)
        {
            MessageBox.Show(statusCode.ToString());
            /*switch (statusCode)
            {
                case StatusCode.:
            }*/
        }

        public void OnEvent(EventData eventData)
        {
            switch ((EventCode) eventData.Code)
            {


                case EventCode.Message:
                    MessageEvent(eventData);
                    break;
            }
        }

        private void MessageEvent(EventData eventData)
        {
            MessageBox.Show((string) eventData.Parameters[(byte) PokerEventParameterCode.Message]);
        }

        public void OpMajStore()
        {
            Dictionary<byte, object> op = new Dictionary<byte, object>();
            PokerAdminPeer.OpCustom((byte)PokerOperationCode.GetLastLoginMode, op, true);
        }
    }

and
public class PokerAdminPeer : PhotonPeer
    {

        public PokerAdminPeer(IPhotonPeerListener listener, ConnectionProtocol protocolType) : base(listener, protocolType)
        {
        }

    }

can you help?

Best

MARQUIS VIncent

Comments

  • WPF application?
    You might need to use the DotNet library for that (Unity has a slightly different variant).
    If Connect() returns false, that could mean the address is not reachable.
  • Hello
    I use Photon3DotNet assembly in my WPF client(who is for admin).
    I had a Unity3D client(my game) who use the exacte same adresse(copy/past) and work but Connect() return false in my WPF client.

    Best
  • I'm not aware of anything that should keep a WPF client from working.
    Are there any settings for the client? Capabilities like in Win 8 Store maybe?
    Do you call Service() in a loop?
  • Ok I wasn't call Service() thanks
    Best
  • This is a general error that indicate the server could not be reached.

    a) Is Vnc running on that PC ?
    b) Is the server and viewer port the same ?
    c) Verify if the port can be reached via telnet?
  • No it's Ok now, the problème was that i didn't call Service() in a loop.
    It work fine.
    Best.
Sign In or Register to comment.