net

package
v3.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2023 License: MIT, Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetConn

type NetConn struct {
	// contains filtered or unexported fields
}

NetConn is a connection to a remote host.

func Open

func Open(protocol, address string) (*NetConn, error)

Open opens a new connection to the address with a timeout. supported protocols: tcp, udp

func OpenTLS

func OpenTLS(protocol, address string) (*NetConn, error)

Open opens a new connection to the address with a timeout. supported protocols: tcp, udp

func (*NetConn) Close

func (c *NetConn) Close() error

Close closes the connection.

func (*NetConn) Recv

func (c *NetConn) Recv(N int) ([]byte, error)

Recv receives data from the connection with a timeout. If N is 0, it will read all data sent by the server with 8MB limit.

func (*NetConn) RecvHex

func (c *NetConn) RecvHex(N int) (string, error)

RecvHex receives data from the connection with a timeout in hex format. If N is 0,it will read all data sent by the server with 8MB limit.

func (*NetConn) RecvString

func (c *NetConn) RecvString(N int) (string, error)

RecvString receives data from the connection with a timeout output is returned as a string. If N is 0, it will read all data sent by the server with 8MB limit.

func (*NetConn) Send

func (c *NetConn) Send(data string) error

Send sends data to the connection with a timeout.

func (*NetConn) SendArray

func (c *NetConn) SendArray(data []interface{}) error

SendArray sends array data to connection

func (*NetConn) SendHex

func (c *NetConn) SendHex(data string) error

SendHex sends hex data to connection

func (*NetConn) SetTimeout

func (c *NetConn) SetTimeout(value int)

SetTimeout sets read/write timeout for the connection (in seconds).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL