using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Security.Authentication;
using System.Net.Sockets;
using SuperSocket.SocketBase.Command;
namespace SuperSocket.SocketBase
{
///
/// CloseReason enum
///
public enum CloseReason : int
{
///
/// The socket is closed for unknown reason
///
Unknown = 0,
///
/// Close for server shutdown
///
ServerShutdown = 1,
///
/// The client close the socket
///
ClientClosing = 2,
///
/// The server side close the socket
///
ServerClosing = 3,
///
/// Application error
///
ApplicationError = 4,
///
/// The socket is closed for a socket error
///
SocketError = 5,
///
/// The socket is closed by server for timeout
///
TimeOut = 6,
///
/// Protocol error
///
ProtocolError = 7,
///
/// SuperSocket internal error
///
InternalError = 8,
}
///
/// The interface for socket session
///
public interface ISocketSession : ISessionBase
{
///
/// Initializes the specified app session.
///
/// The app session.
void Initialize(IAppSession appSession);
///
/// Starts this instance.
///
void Start();
///
/// Closes the socket session for the specified reason.
///
/// The reason.
void Close(CloseReason reason);
///
/// Tries to send array segment.
///
/// The segments.
bool TrySend(IList> segments);
///
/// Tries to send array segment.
///
/// The segment.
bool TrySend(ArraySegment segment);
///
/// Applies the secure protocol.
///
void ApplySecureProtocol();
///
/// Gets the client socket.
///
Socket Client { get; }
///
/// Gets the local listening endpoint.
///
IPEndPoint LocalEndPoint { get; }
///
/// Gets or sets the secure protocol.
///
///
/// The secure protocol.
///
SslProtocols SecureProtocol { get; set; }
///
/// Occurs when [closed].
///
Action Closed { get; set; }
///
/// Gets the app session assosiated with this socket session.
///
IAppSession AppSession { get; }
///
/// Gets the original receive buffer offset.
///
///
/// The original receive buffer offset.
///
int OrigReceiveOffset { get; }
}
}