Class StreamSocket
A stream socket.
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class StreamSocket : ManagedSocket
Properties
OnReceiveFailure
Gets or sets a callback invoked on failed read from TCP stream.
Declaration
public Action2<Exception, bool> OnReceiveFailure { get; set; }
Property Value
Type | Description |
---|---|
Action2<Exception, System. |
OnReceiveSuccess
Gets or sets a callback invoked on successful read from TCP stream.
Declaration
public Action1<DataBuffer> OnReceiveSuccess { get; set; }
Property Value
Type | Description |
---|---|
Action1<Data |
RemoteHostname
Gets or sets the remote hostname.
Declaration
public abstract string RemoteHostname { get; }
Property Value
Type | Description |
---|---|
System. |
RemoteIPAddress
Gets or sets the remote IP address.
Declaration
public abstract string RemoteIPAddress { get; }
Property Value
Type | Description |
---|---|
System. |
RemotePort
Gets or sets the remote port.
Declaration
public abstract int RemotePort { get; }
Property Value
Type | Description |
---|---|
System. |
Secure
Gets a value indicating whether the socket is secure.
Declaration
public abstract bool Secure { get; }
Property Value
Type | Description |
---|---|
System. |
Server
Gets a value indicating whether the socket can accept incoming connections.
Declaration
public abstract bool Server { get; }
Property Value
Type | Description |
---|---|
System. |
Methods
AcceptAsync(Action0, Action1<Exception>, Action1<StreamSocket>)
Accepts a new socket asynchronously.
Declaration
public abstract void AcceptAsync(Action0 onSuccess, Action1<Exception> onFailure, Action1<StreamSocket> onSocket)
Parameters
Type | Name | Description |
---|---|---|
Action0 | onSuccess | The callback to invoke on success. |
Action1<Exception> | onFailure | The callback to invoke on failure. |
Action1<Stream |
onSocket | The callback to invoke when a socket is ready. |
ConnectAsync(String, String, Int32, Int32, Action0, Action2<Exception, Boolean>)
Connects the socket asynchronously.
Declaration
public abstract void ConnectAsync(string hostname, string ipAddress, int port, int timeout, Action0 onSuccess, Action2<Exception, bool> onFailure)
Parameters
Type | Name | Description |
---|---|---|
System. |
hostname | The remote hostname. |
System. |
ipAddress | The remote IP address. |
System. |
port | The remote port. |
System. |
timeout | The timeout (in ms). |
Action0 | onSuccess | The callback to invoke on success. |
Action2<Exception, System. |
onFailure | The callback to invoke on failure. |
RaiseAcceptFailure(Action1<Exception>, Exception)
Invokes the accept failure callback.
Declaration
protected void RaiseAcceptFailure(Action1<Exception> callback, Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Action1<Exception> | callback | The callback. |
Exception | exception | The exception. |
RaiseAcceptSocket(Action1<StreamSocket>, StreamSocket)
Invokes the accept success callback.
Declaration
protected void RaiseAcceptSocket(Action1<StreamSocket> callback, StreamSocket socket)
Parameters
Type | Name | Description |
---|---|---|
Action1<Stream |
callback | The callback. |
Stream |
socket | The socket. |
RaiseAcceptSuccess(Action0)
Invokes the accept success callback.
Declaration
protected void RaiseAcceptSuccess(Action0 callback)
Parameters
Type | Name | Description |
---|---|---|
Action0 | callback | The callback. |
RaiseConnectFailure(Action2<Exception, Boolean>, Exception, Boolean)
Invokes the connect failure callback.
Declaration
protected void RaiseConnectFailure(Action2<Exception, bool> callback, Exception exception, bool timedOut)
Parameters
Type | Name | Description |
---|---|---|
Action2<Exception, System. |
callback | The callback. |
Exception | exception | The exception. |
System. |
timedOut | if set to |
RaiseConnectSuccess(Action0)
Invokes the connect success callback.
Declaration
protected void RaiseConnectSuccess(Action0 callback)
Parameters
Type | Name | Description |
---|---|---|
Action0 | callback | The callback. |
RaiseReceiveFailure(Action2<Exception, Boolean>, Exception, Boolean)
Invokes the receive failure callback.
Declaration
protected void RaiseReceiveFailure(Action2<Exception, bool> callback, Exception exception, bool timedOut)
Parameters
Type | Name | Description |
---|---|---|
Action2<Exception, System. |
callback | The callback. |
Exception | exception | The exception. |
System. |
timedOut | if set to |
RaiseReceiveSuccess(Action1<DataBuffer>, DataBuffer)
Invokes the receive success callback.
Declaration
protected void RaiseReceiveSuccess(Action1<DataBuffer> callback, DataBuffer buffer)
Parameters
Type | Name | Description |
---|---|---|
Action1<Data |
callback | The callback. |
Data |
buffer | The buffer. |
RaiseSendFailure(Action2<Exception, Boolean>, Exception, Boolean)
Invokes the send failure callback.
Declaration
protected void RaiseSendFailure(Action2<Exception, bool> callback, Exception exception, bool timedOut)
Parameters
Type | Name | Description |
---|---|---|
Action2<Exception, System. |
callback | The callback. |
Exception | exception | The exception. |
System. |
timedOut | if set to |
RaiseSendSuccess(Action0)
Invokes the send success callback.
Declaration
protected void RaiseSendSuccess(Action0 callback)
Parameters
Type | Name | Description |
---|---|---|
Action0 | callback | The callback. |
ReceiveAsync(Int32)
Receives data asynchronously.
Declaration
public abstract void ReceiveAsync(int timeout)
Parameters
Type | Name | Description |
---|---|---|
System. |
timeout | The timeout (in ms). |
Send(DataBuffer)
Sends data synchronously.
Declaration
public abstract bool Send(DataBuffer buffer)
Parameters
Type | Name | Description |
---|---|---|
Data |
buffer | The buffer. |
Returns
Type | Description |
---|---|
System. |
SendAsync(DataBuffer, Int32, Action0, Action2<Exception, Boolean>)
Sends data asynchronously.
Declaration
public abstract void SendAsync(DataBuffer buffer, int timeout, Action0 onSuccess, Action2<Exception, bool> onFailure)
Parameters
Type | Name | Description |
---|---|---|
Data |
buffer | The buffer. |
System. |
timeout | The timeout (in ms). |
Action0 | onSuccess | The callback to invoke on success. |
Action2<Exception, System. |
onFailure | The callback to invoke on failure. |