Search Results for

    Show / Hide Table of Contents

    Class TcpSocket

    A TCP socket.

    Inheritance
    System.Object
    ManagedSocket
    StreamSocket
    TcpSocket
    Inherited Members
    StreamSocket.OnReceiveSuccess
    StreamSocket.OnReceiveFailure
    StreamSocket.RaiseAcceptSuccess(Action0)
    StreamSocket.RaiseAcceptFailure(Action1<Exception>, Exception)
    StreamSocket.RaiseAcceptSocket(Action1<StreamSocket>, StreamSocket)
    StreamSocket.RaiseConnectSuccess(Action0)
    StreamSocket.RaiseConnectFailure(Action2<Exception, Boolean>, Exception, Boolean)
    StreamSocket.RaiseSendSuccess(Action0)
    StreamSocket.RaiseSendFailure(Action2<Exception, Boolean>, Exception, Boolean)
    StreamSocket.RaiseReceiveSuccess(Action1<DataBuffer>, DataBuffer)
    StreamSocket.RaiseReceiveFailure(Action2<Exception, Boolean>, Exception, Boolean)
    ManagedSocket.PublicIPAddresses
    ManagedSocket.AdapterSpeed
    Namespace: FM.LiveSwitch
    Assembly: FM.LiveSwitch.dll
    Syntax
    public class TcpSocket : StreamSocket

    Constructors

    TcpSocket(Boolean, Boolean, Boolean)

    Initializes a new instance of the TcpSocket class.

    Declaration
    public TcpSocket(bool server, bool ipv6, bool secure)
    Parameters
    Type Name Description
    System.Boolean server

    Whether the socket is going to accept new incoming connections.

    System.Boolean ipv6

    Whether an IPv6 socket should be created.

    System.Boolean secure

    Whether to send data securely using SSL.

    TcpSocket(StreamSocket, Boolean, Boolean)

    Initializes a new instance of the TcpSocket class.

    Declaration
    public TcpSocket(StreamSocket socket, bool server, bool secure)
    Parameters
    Type Name Description
    Windows.Networking.Sockets.StreamSocket socket

    The existing socket.

    System.Boolean server

    Whether the socket is server-side.

    System.Boolean secure

    Whether the socket is secure.

    Properties

    AttemptNoDelay

    Attempt to set the Socket NoDelay property to disable Nagling. Default is false. You must "opt-in".

    Declaration
    public static bool AttemptNoDelay { get; set; }
    Property Value
    Type Description
    System.Boolean

    Certificate

    Gets or sets the certificate to use to secure the socket. This is required for secure server sockets.

    Declaration
    public static System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { get; set; }
    Property Value
    Type Description
    System.Security.Cryptography.X509Certificates.X509Certificate2

    DisableProxy

    Gets or sets whether the system proxy should be disabled.

    Declaration
    public static bool DisableProxy { get; set; }
    Property Value
    Type Description
    System.Boolean

    IPv6

    Gets a value indicating whether the socket supports IPv6.

    Declaration
    public override bool IPv6 { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    ManagedSocket.IPv6

    IsClosed

    Gets a value indicating whether this instance is closed.

    Declaration
    public override bool IsClosed { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    ManagedSocket.IsClosed

    ListenBacklog

    Gets or sets the maximum length of the pending connections queue.

    Declaration
    public int ListenBacklog { get; set; }
    Property Value
    Type Description
    System.Int32

    LocalIPAddress

    Gets the local IP address.

    Declaration
    public override string LocalIPAddress { get; }
    Property Value
    Type Description
    System.String
    Overrides
    ManagedSocket.LocalIPAddress

    LocalPort

    Gets the local port.

    Declaration
    public override int LocalPort { get; }
    Property Value
    Type Description
    System.Int32
    Overrides
    ManagedSocket.LocalPort

    ManualProxyHostname

    Gets or sets the manual proxy hostname, which overrides system settings.

    Declaration
    public static string ManualProxyHostname { get; set; }
    Property Value
    Type Description
    System.String

    ManualProxyPort

    Gets or sets the manual proxy proxy, which overrides system settings.

    Declaration
    public static int ManualProxyPort { get; set; }
    Property Value
    Type Description
    System.Int32

    ProxyIPAddress

    Gets or sets the proxy IP address.

    Declaration
    public string ProxyIPAddress { get; }
    Property Value
    Type Description
    System.String

    ProxyPassword

    Gets or sets the proxy password, if the proxy requires a username.

    Declaration
    public static string ProxyPassword { get; set; }
    Property Value
    Type Description
    System.String

    ProxyPort

    Gets or sets the proxy port.

    Declaration
    public int ProxyPort { get; }
    Property Value
    Type Description
    System.Int32

    ProxyUsername

    Gets or sets the proxy username, if the proxy requires a username.

    Declaration
    public static string ProxyUsername { get; set; }
    Property Value
    Type Description
    System.String

    RemoteHostname

    Gets the remote hostname.

    Declaration
    public override string RemoteHostname { get; }
    Property Value
    Type Description
    System.String
    Overrides
    StreamSocket.RemoteHostname

    RemoteIPAddress

    Gets the remote IP address.

    Declaration
    public override string RemoteIPAddress { get; }
    Property Value
    Type Description
    System.String
    Overrides
    StreamSocket.RemoteIPAddress

    RemotePort

    Gets the remote port.

    Declaration
    public override int RemotePort { get; }
    Property Value
    Type Description
    System.Int32
    Overrides
    StreamSocket.RemotePort

    Secure

    Gets a value indicating whether the socket is secure.

    Declaration
    public override bool Secure { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    StreamSocket.Secure

    Server

    Gets a value indicating whether the socket can accept incoming connections.

    Declaration
    public override bool Server { get; }
    Property Value
    Type Description
    System.Boolean
    Overrides
    StreamSocket.Server

    Socket

    Gets the underlying socket.

    Declaration
    public StreamSocket Socket { get; }
    Property Value
    Type Description
    Windows.Networking.Sockets.StreamSocket

    Methods

    AcceptAsync(Action0, Action1<Exception>, Action1<StreamSocket>)

    Accepts a new socket asynchronously.

    Declaration
    public override 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<StreamSocket> onSocket

    The callback to invoke when a socket is ready.

    Overrides
    StreamSocket.AcceptAsync(Action0, Action1<Exception>, Action1<StreamSocket>)

    AcceptAsync(Action0, Action1<Exception>, Action1<StreamSocket>, Action1<Exception>)

    Accepts a new socket asynchronously.

    Declaration
    public void AcceptAsync(Action0 onSuccess, Action1<Exception> onFailure, Action1<StreamSocket> onSocket, Action1<Exception> onSocketFailure)
    Parameters
    Type Name Description
    Action0 onSuccess

    The callback to invoke on success.

    Action1<Exception> onFailure

    The callback to invoke on failure.

    Action1<StreamSocket> onSocket

    The callback to invoke when a socket is ready.

    Action1<Exception> onSocketFailure

    The callback to invoke when a socket fails to become ready.

    Bind(String, Int32, out Boolean)

    Binds the socket to a local endpoint.

    Declaration
    public override bool Bind(string ipAddress, int port, out bool addressInUse)
    Parameters
    Type Name Description
    System.String ipAddress

    The local IP address.

    System.Int32 port

    The local port.

    System.Boolean addressInUse

    Indicates that access to the address is forbidden or in use.

    Returns
    Type Description
    System.Boolean
    Overrides
    ManagedSocket.Bind(String, Int32, out Boolean)

    Close()

    Closes the socket.

    Declaration
    public override void Close()
    Overrides
    ManagedSocket.Close()

    ConnectAsync(String, String, Int32, Int32, Action0, Action2<Exception, Boolean>)

    Connects the socket asynchronously.

    Declaration
    public override void ConnectAsync(string hostname, string ipAddress, int port, int timeout, Action0 onSuccess, Action2<Exception, bool> onFailure)
    Parameters
    Type Name Description
    System.String hostname

    The remote hostname.

    System.String ipAddress

    The remote IP address.

    System.Int32 port

    The remote port.

    System.Int32 timeout

    The timeout (in ms).

    Action0 onSuccess

    The callback to invoke on success.

    Action2<Exception, System.Boolean> onFailure

    The callback to invoke on failure.

    Overrides
    StreamSocket.ConnectAsync(String, String, Int32, Int32, Action0, Action2<Exception, Boolean>)

    ReceiveAsync(Int32)

    Receives data asynchronously.

    Declaration
    public override void ReceiveAsync(int timeout)
    Parameters
    Type Name Description
    System.Int32 timeout

    The timeout (in ms).

    Overrides
    StreamSocket.ReceiveAsync(Int32)

    Send(DataBuffer)

    Sends data synchronously.

    Declaration
    public override bool Send(DataBuffer buffer)
    Parameters
    Type Name Description
    DataBuffer buffer

    The buffer.

    Returns
    Type Description
    System.Boolean
    Overrides
    StreamSocket.Send(DataBuffer)

    SendAsync(DataBuffer, Int32, Action0, Action2<Exception, Boolean>)

    Sends data asynchronously.

    Declaration
    public override void SendAsync(DataBuffer buffer, int timeout, Action0 onSuccess, Action2<Exception, bool> onFailure)
    Parameters
    Type Name Description
    DataBuffer buffer

    The buffer.

    System.Int32 timeout

    The timeout (in ms).

    Action0 onSuccess

    The callback to invoke on success.

    Action2<Exception, System.Boolean> onFailure

    The callback to invoke on failure.

    Overrides
    StreamSocket.SendAsync(DataBuffer, Int32, Action0, Action2<Exception, Boolean>)

    Events

    OnSocketCreated

    Raised when a socket has been created and initialized.

    Declaration
    public static event Action1<TcpSocket> OnSocketCreated
    Event Type
    Type Description
    Action1<TcpSocket>
    In This Article
    Back to top Copyright © LiveSwitch Inc. All Rights Reserved. Doc build for LiveSwitch v1.15.0