Exemplo n.º 1
0
        public Client(IPEndPoint host)
        {
            Host = host;
            var conf = new NetPeerConfiguration("SpagAachen.Ballz");

            conf.ConnectionTimeout = 10;
            conf.PingInterval      = 2;
            Peer = new NetClient(conf);

            Sync = new ObjectSynchronizer(Peer);
            Sync.NewObjectReceived += (s, data) => OnData(data);
        }
Exemplo n.º 2
0
        public Server(FullGameInfo info)
        {
            GameInfo = info;
            var config = new NetPeerConfiguration(Network.ApplicationIdentifier);

            config.Port = Network.DefaultPort; // TODO: make port configurable
            config.ConnectionTimeout         = Network.ConnectionTimeoutSeconds;
            config.AcceptIncomingConnections = true;
            config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest);
            Peer = new NetServer(config);
            Sync = new ObjectSynchronizer(Peer);
            Sync.NewObjectReceived += OnData;
        }