C# Class MemcachedClientLibrary.PooledSocket

The PooledSocket class encapsulates a socket connection to a specified memcached server. It contains a buffered stream for communication, and methods for sending and retrieving data from the memcached server, as well as general memcached error checking.
Inheritance: IDisposable
Mostrar archivo Open project: noear/Weed3 Class Usage Examples

Public Properties

Property Type Description
Created System.DateTime

Public Methods

Method Description
Close ( ) : void

This method closes the underlying stream and socket.

Dispose ( ) : void

Disposing of a PooledSocket object in any way causes it to be returned to its SocketPool.

PooledSocket ( SocketPool socketPool, IPEndPoint endPoint, int sendReceiveTimeout ) : System
Read ( byte bytes ) : void

Fills the given byte array with data from the socket.

ReadLine ( ) : string

Reads from the socket until the sequence '\r\n' is encountered, and returns everything up to but not including that sequence as a UTF8-encoded string

ReadResponse ( ) : string

Reads a response line from the socket, checks for general memcached errors, and returns the line. If an error is encountered, this method will throw an exception.

Reset ( ) : bool

Resets this PooledSocket by making sure the incoming buffer of the socket is empty. If there was any leftover data, this method return true.

SkipUntilEndOfLine ( ) : void

Reads from the socket until the sequence '\r\n' is encountered.

Write ( byte bytes ) : void

Writes an array of bytes to the socket and flushes the stream.

Write ( string str ) : void

Writes a string to the socket encoded in UTF8 format.

Method Details

Close() public method

This method closes the underlying stream and socket.
public Close ( ) : void
return void

Dispose() public method

Disposing of a PooledSocket object in any way causes it to be returned to its SocketPool.
public Dispose ( ) : void
return void

PooledSocket() public method

public PooledSocket ( SocketPool socketPool, IPEndPoint endPoint, int sendReceiveTimeout ) : System
socketPool SocketPool
endPoint System.Net.IPEndPoint
sendReceiveTimeout int
return System

Read() public method

Fills the given byte array with data from the socket.
public Read ( byte bytes ) : void
bytes byte
return void

ReadLine() public method

Reads from the socket until the sequence '\r\n' is encountered, and returns everything up to but not including that sequence as a UTF8-encoded string
public ReadLine ( ) : string
return string

ReadResponse() public method

Reads a response line from the socket, checks for general memcached errors, and returns the line. If an error is encountered, this method will throw an exception.
public ReadResponse ( ) : string
return string

Reset() public method

Resets this PooledSocket by making sure the incoming buffer of the socket is empty. If there was any leftover data, this method return true.
public Reset ( ) : bool
return bool

SkipUntilEndOfLine() public method

Reads from the socket until the sequence '\r\n' is encountered.
public SkipUntilEndOfLine ( ) : void
return void

Write() public method

Writes an array of bytes to the socket and flushes the stream.
public Write ( byte bytes ) : void
bytes byte
return void

Write() public method

Writes a string to the socket encoded in UTF8 format.
public Write ( string str ) : void
str string
return void

Property Details

Created public_oe property

public DateTime,System Created
return System.DateTime