NetSocket

open class NetSocket : NSObject
extension NetSocket: StreamDelegate

The NetSocket class creates a two-way connection between a client and a server as a client. This class is wrapper for a InputStream and an OutputStream.

  • The default time to wait for TCP/IP Handshake done.

    Declaration

    Swift

    public static let defaultTimeout: Int
  • The default stream’s TCP window size.

    Declaration

    Swift

    public static let defaultWindowSizeC: Int
  • The default quality of service.

    Declaration

    Swift

    public static let defaultQualityOfService: DispatchQoS
  • The current incoming data buffer.

    Declaration

    Swift

    public var inputBuffer: Data
  • Specifies time to wait for TCP/IP Handshake done.

    Declaration

    Swift

    public var timeout: Int
  • Specifies instance connected to server(true) or not(false).

    Declaration

    Swift

    public var connected: Bool
  • Specifies the output buffer size in bytes.

    Declaration

    Swift

    public var windowSizeC: Int
  • Specifies statistics of total incoming bytes.

    Declaration

    Swift

    public var totalBytesIn: Atomic<Int64>
  • Specifies instance’s quality of service for a Socket IO.

    Declaration

    Swift

    public var qualityOfService: DispatchQoS
  • Specifies instance determine to use the secure-socket layer (SSL) security level.

    Declaration

    Swift

    public var securityLevel: StreamSocketSecurityLevel
  • Specifies the output buffer size in bytes.

    Declaration

    Swift

    public var outputBufferSize: Int
  • Specifies statistics of total outgoing bytes.

    Declaration

    Swift

    public private(set) var totalBytesOut: Atomic<Int64> { get }
  • Specifies statistics of total outgoing queued bytes.

    Declaration

    Swift

    public private(set) var queueBytesOut: Atomic<Int64> { get }
  • Creates a two-way connection to a server.

    Declaration

    Swift

    public func connect(withName: String, port: Int)
  • Does output data buffer to the server.

    Declaration

    Swift

    @discardableResult
    public func doOutput(data: Data, locked: UnsafeMutablePointer<UInt32>? = nil) -> Int
  • Closes the connection from the server.

    Declaration

    Swift

    open func close()
  • Listen incoming data buffer from the server.

    Declaration

    Swift

    open func listen()

StreamDelegate

  • Undocumented

    Declaration

    Swift

    public func stream(_ aStream: Stream, handle eventCode: Stream.Event)