C# Class OpenStory.Networking.EncryptedNetworkSession

Inheritance: INetworkSession, IDisposable
Exibir arquivo Open project: shoftee/OpenStory

Public Methods

Method Description
AttachSocket ( Socket sessionSocket ) : void

Attaches a Socket to this session.

Close ( string reason ) : void

Closes the session.

Dispose ( ) : void
ToString ( ) : string
WritePacket ( byte packet ) : void

Encrypts the given data as a packet and writes it to the network stream.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Runs the disposal operations for the base class.

EncryptedNetworkSession ( ) : System

Initializes a new instance of the EncryptedNetworkSession class with no specified socket.

Call AttachSocket(Socket) before starting the network operations.

OnDataArrived ( object sender, DataArrivedEventArgs args ) : void

Called when the PacketReceived event is raised.

When overriding this method in a derived class, call the base implementation after your logic.

ThrowIfNoPacketReceivedSubscriber ( ) : void

Checks if the PacketReceived event has a subscriber and throws InvalidOperationException if not.

Private Methods

Method Description
CreateInnerSession ( ) : NetworkSession
OnClosing ( object sender, ConnectionClosingEventArgs e ) : void
OnPacketReceived ( PacketReceivedEventArgs args ) : void
OnSocketError ( object sender, SocketErrorEventArgs e ) : void

Method Details

AttachSocket() public method

Attaches a Socket to this session.
public AttachSocket ( Socket sessionSocket ) : void
sessionSocket System.Net.Sockets.Socket The to attach.
return void

Close() public method

Closes the session.
public Close ( string reason ) : void
reason string
return void

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

Runs the disposal operations for the base class.
protected Dispose ( bool disposing ) : void
disposing bool Whether the method is being called for disposal or finalization.
return void

EncryptedNetworkSession() protected method

Initializes a new instance of the EncryptedNetworkSession class with no specified socket.
Call AttachSocket(Socket) before starting the network operations.
protected EncryptedNetworkSession ( ) : System
return System

OnDataArrived() protected method

Called when the PacketReceived event is raised.
When overriding this method in a derived class, call the base implementation after your logic.
Thrown if is .
protected OnDataArrived ( object sender, DataArrivedEventArgs args ) : void
sender object The sender of the event.
args DataArrivedEventArgs The packet data that was received.
return void

ThrowIfNoPacketReceivedSubscriber() protected method

Checks if the PacketReceived event has a subscriber and throws InvalidOperationException if not.
protected ThrowIfNoPacketReceivedSubscriber ( ) : void
return void

ToString() public method

public ToString ( ) : string
return string

WritePacket() public method

Encrypts the given data as a packet and writes it to the network stream.
/// Thrown if is . ///
public WritePacket ( byte packet ) : void
packet byte The data to send.
return void