public ConnectionStream(PacketDistributor packetDistributor, CSteamID remote, int channelID, EP2PSend reliability) { Remote = remote; ChannelID = channelID; Reliability = reliability; this.packetDistributor = packetDistributor; packetDistributor.PacketReceived += OnPacketReceived; }
public Connection(SessionCallbackDistributor callbackDistributor, PacketDistributor packetDistributor, IList <EP2PSend> channels, CSteamID remote) { Remote = remote; allStreams = channels.Select((c, i) => new ConnectionStream(packetDistributor, remote, i, c)).ToArray(); normalStreams = allStreams.Take(channels.Count - 1).ToArray(); systemStream = allStreams.Skip(channels.Count - 1).Single(); SystemChannelID = channels.Count - 1; this.callbackDistributor = callbackDistributor; callbackDistributor.ConnectFailed += OnConnectFailed; }
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(); }
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(); }