Options
All
  • Public
  • Public/Protected
  • All
Menu

It represents a TCP comm at the client side.

Hierarchy

  • TcpComm

Index

Constructors

  • new TcpComm(address: string, port: number): TcpComm
  • Creates an instance of the TcpComm class wiht the specified information.

    Parameters

    • address: string

      The IP address.

    • port: number

      The port number.

    Returns TcpComm

Accessors

  • get receiveBufferSize(): number
  • set receiveBufferSize(value: number): void
  • Gets or sets the size of the receive buffer, in bytes. Default value is 8192

    Returns number

  • Gets or sets the size of the receive buffer, in bytes. Default value is 8192

    Parameters

    • value: number

    Returns void

  • get timeout(): number
  • set timeout(value: number): void
  • Gets or sets the milliseconds to wait to receive data once a read operation is initiated. Default value is 1000

    Returns number

  • Gets or sets the milliseconds to wait to receive data once a read operation is initiated. Default value is 1000

    Parameters

    • value: number

    Returns void

Methods

  • close(): void
  • Closes the TCP connection

    Returns void

  • connect(): Promise<unknown>
  • Connects to a TCP host using the specified IP address and port number.

    Returns Promise<unknown>

  • onClose(data: any): void
  • Occurs when communication is close.

    Parameters

    • data: any

      The callback function

    Returns void

  • onDataReceived(data: any): void
  • Occurs when data is received.

    Parameters

    • data: any

      The callback function

    Returns void

  • onError(data: any, critical: any): void
  • Occurs when an error is thrown.

    Parameters

    • data: any

      The callback function

    • critical: any

    Returns void

  • propertiesJSON(): { type: string }
  • Returns { type: string }

    • type: string
  • send(utf8string: string): void
  • Sends the specified string to the TCP host.

    Parameters

    • utf8string: string

      The string to send to the TCP host.

    Returns void