Documentation
¶
Index ¶
- Constants
- func CreateSocketReader(protocol string, addr string, port uint16) (io.ReadCloser, error)
- func CreateSocketWriter(protocol string, addr string, port uint16) (io.WriteCloser, error)
- func NewTCPSocketReader(addr string, port uint16) (io.ReadCloser, error)
- func NewTCPSocketWriter(addr string, port uint16) (io.WriteCloser, error)
- func NewUDPSocketReader(addr string, port uint16) (io.ReadCloser, error)
- func NewUDPSocketWriter(addr string, port uint16) (io.WriteCloser, error)
- type TCPTimeoutReader
- type UDPTimeoutReader
Constants ¶
View Source
const (
SocketReadDeadline = 10 * time.Millisecond
)
Variables ¶
This section is empty.
Functions ¶
func CreateSocketReader ¶
func CreateSocketWriter ¶
func NewTCPSocketReader ¶
func NewTCPSocketReader(addr string, port uint16) (io.ReadCloser, error)
func NewTCPSocketWriter ¶
func NewTCPSocketWriter(addr string, port uint16) (io.WriteCloser, error)
func NewUDPSocketReader ¶
func NewUDPSocketReader(addr string, port uint16) (io.ReadCloser, error)
func NewUDPSocketWriter ¶
func NewUDPSocketWriter(addr string, port uint16) (io.WriteCloser, error)
Types ¶
type TCPTimeoutReader ¶
type TCPTimeoutReader struct {
Listener *net.TCPListener
Conns []*net.TCPConn
// contains filtered or unexported fields
}
func (TCPTimeoutReader) Close ¶
func (r TCPTimeoutReader) Close() error
Close all connections then the listener. Only the first occurring error will be returned.
func (*TCPTimeoutReader) Read ¶
func (r *TCPTimeoutReader) Read(b []byte) (n int, err error)
Firstly calls [acceptWaitingConnections]. Then wraps the read with a deadline to timeout the Read attempt if there is no incoming data. Timeout used is SocketReadDeadline. Removes any connections that have been closed.
type UDPTimeoutReader ¶
func (UDPTimeoutReader) Close ¶
func (r UDPTimeoutReader) Close() error
func (UDPTimeoutReader) Read ¶
func (r UDPTimeoutReader) Read(b []byte) (n int, err error)
Wraps the read with a deadline to timeout the Read attempt if there is no incoming data. Timeout used is SocketReadDeadline.
Click to show internal directories.
Click to hide internal directories.