public ServiceHost createLobby(string ip, Lobby lobby)
        {
            string uri = TCP_CONN_STR + ip;

            ServiceHost host = new ServiceHost(
                lobby,
                new Uri[]{
                    new Uri(uri)
                });

            host.AddServiceEndpoint(typeof(ILobby),
                new NetTcpBinding(SecurityMode.None),
                LOBBY_NAME);

            ServiceHost discoveryHost = new ServiceHost(
                new DiscoveryTest(),
                new Uri[]{
                    new Uri(uri + "/Discovery")
                });

            discoveryHost.Description.Behaviors.Add(new ServiceDiscoveryBehavior());
            discoveryHost.AddServiceEndpoint(new UdpDiscoveryEndpoint());

            discoveryHost.AddServiceEndpoint(typeof(IDiscoveryTest),
                new NetTcpBinding(SecurityMode.None),
                "");

            discoveryHost.Open();

            return host;
        }
Example #2
0
 public Server(WCFServiceFactory serviceFactory, string IP)
 {
     this.IP = IP;
     this.serviceFactory = serviceFactory;
     lobby = new Lobby(this);
     games = new Dictionary<string, BattleShipServer.WCFConnection.Server.Game>();
     gameSHs = new Dictionary<string, ServiceHost>();
 }
        public ServiceHost createLobby(string ip, Lobby lobby)
        {
            string uri = HTTP_CONN_STR + ip;

            ServiceHost host = new ServiceHost(
                lobby,
                new Uri[]{
                    new Uri(uri)
                });

            host.AddServiceEndpoint(typeof(ILobby),
                new WSDualHttpBinding(WSDualHttpSecurityMode.None),
                LOBBY_NAME);

            return host;
        }