// This file is provided under The MIT License as part of RiptideNetworking.
// Copyright (c) Tom Weiland
// For additional information please see the included LICENSE.md file or view it on GitHub:
// https://github.com/RiptideNetworking/Riptide/blob/main/LICENSE.md
namespace Riptide.Transports
{
/// Contains event data for when a server's transport successfully establishes a connection to a client.
public class ConnectedEventArgs
{
/// The newly established connection.
public readonly Connection Connection;
/// Initializes event data.
/// The newly established connection.
public ConnectedEventArgs(Connection connection)
{
Connection = connection;
}
}
/// Contains event data for when a server's or client's transport receives data.
public class DataReceivedEventArgs
{
/// An array containing the received data.
public readonly byte[] DataBuffer;
/// The number of bytes that were received.
public readonly int Amount;
/// The connection which the data was received from.
public readonly Connection FromConnection;
/// Initializes event data.
/// An array containing the received data.
/// The number of bytes that were received.
/// The connection which the data was received from.
public DataReceivedEventArgs(byte[] dataBuffer, int amount, Connection fromConnection)
{
DataBuffer = dataBuffer;
Amount = amount;
FromConnection = fromConnection;
}
}
/// Contains event data for when a server's or client's transport initiates or detects a disconnection.
public class DisconnectedEventArgs
{
/// The closed connection.
public readonly Connection Connection;
/// The reason for the disconnection.
public readonly DisconnectReason Reason;
/// Initializes event data.
/// The closed connection.
/// The reason for the disconnection.
public DisconnectedEventArgs(Connection connection, DisconnectReason reason)
{
Connection = connection;
Reason = reason;
}
}
}