Beispiel #1
0
        public Server(SteamLocoTransport transport, IList <EP2PSend> channels)
        {
            this.transport = transport;
            this.channels  = channels;

            packetDistributor = new PacketDistributor(channels);
            packetDistributor.PacketReceived     += OnPacketReceived;
            callbackDistributor.ConnectRequested += OnConnectRequest;

            var steamID = SteamUser.GetSteamID();

            connectionIDToSteamID.Add(steamID);
            steamIDToConnectionID.Add(steamID, connectionIDToSteamID.Count - 1);

            thread = new Thread(NativeUpdate);
            thread.Start();
        }
Beispiel #2
0
        public Client(SteamLocoTransport transport, CSteamID remote, IList <EP2PSend> channels, TimeSpan connectTimeout)
        {
            this.transport = transport;

            callbackDistributor = new SessionCallbackDistributor();
            packetDistributor   = new PacketDistributor(channels);
            connection          = new Connection(callbackDistributor, packetDistributor, channels, remote);
            establisher         = new ConnectionEstablisherClient(connection, connectTimeout);

            callbackDistributor.ConnectRequested += OnConnectRequested;

            establisher.Connected    += OnConnected;
            establisher.Disconnected += OnDisconnected;

            // handle establisher's timeout

            thread = new Thread(NativeUpdate);
            thread.Start();
        }