C# Class Granados.IO.PlainSocket

Inheritance: Granados.IO.AbstractGranadosSocket
Mostrar archivo Open project: poderosaproject/poderosa Class Usage Examples

Public Methods

Method Description
Close ( ) : void

Close connection

Dispose ( ) : void

Implements IDisposable.

PlainSocket ( Socket socket, IDataHandler handler ) : System

Constructor

ReadIfAvailable ( byte buf ) : int

Read bytes if any data can be read.

This method fails if asynchronous receiving is already started by RepeatAsyncRead().

RepeatAsyncRead ( ) : void

Start asynchronous receiving cycle.

SetHandler ( IDataHandler handler ) : void

Set callback handler.

Write ( byte data, int offset, int length ) : void

Write data to the socket

Private Methods

Method Description
DoClose ( ) : void
FireOnClosed ( ) : void

Call OnClosed() callback

ReceivingThread ( ) : void

Receiving thread

Method Details

Close() public method

Close connection
public Close ( ) : void
return void

Dispose() public method

Implements IDisposable.
public Dispose ( ) : void
return void

PlainSocket() public method

Constructor
public PlainSocket ( Socket socket, IDataHandler handler ) : System
socket System.Net.Sockets.Socket socket object (must be already connected)
handler IDataHandler callback handler (can be null if no handler is specified)
return System

ReadIfAvailable() public method

Read bytes if any data can be read.
This method fails if asynchronous receiving is already started by RepeatAsyncRead().
public ReadIfAvailable ( byte buf ) : int
buf byte byte array to store data in.
return int

RepeatAsyncRead() public method

Start asynchronous receiving cycle.
public RepeatAsyncRead ( ) : void
return void

SetHandler() public method

Set callback handler.
public SetHandler ( IDataHandler handler ) : void
handler IDataHandler handler
return void

Write() public method

Write data to the socket
public Write ( byte data, int offset, int length ) : void
data byte byte array that contains data to write
offset int start index of data
length int byte count to write
return void