conn

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenUDP added in v0.9.0

func ListenUDP(bindAddr string, bindPort int64) (conn *net.UDPConn, err error)

Types

type Conn

type Conn struct {
	TcpConn net.Conn
	Reader  *bufio.Reader
	// contains filtered or unexported fields
}

wrap for TCPConn

func ConnectServer

func ConnectServer(addr string) (c *Conn, err error)

func ConnectServerByHttpProxy added in v0.9.0

func ConnectServerByHttpProxy(httpProxy string, serverAddr string) (c *Conn, err error)

func NewConn

func NewConn(conn net.Conn) (c *Conn)

func (*Conn) CheckClosed

func (c *Conn) CheckClosed() bool

when you call this function, you should make sure that remote client won't send any bytes to this socket

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) GetLocalAddr

func (c *Conn) GetLocalAddr() (addr string)

func (*Conn) GetRemoteAddr

func (c *Conn) GetRemoteAddr() (addr string)

func (*Conn) IsClosed

func (c *Conn) IsClosed() (closeFlag bool)

func (*Conn) Read

func (c *Conn) Read(p []byte) (n int, err error)

func (*Conn) ReadLine

func (c *Conn) ReadLine() (buff string, err error)

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetTcpConn

func (c *Conn) SetTcpConn(tcpConn net.Conn)

if the tcpConn is different with c.TcpConn you should call c.Close() first

func (*Conn) Write

func (c *Conn) Write(content []byte) (n int, err error)

func (*Conn) WriteString added in v0.9.0

func (c *Conn) WriteString(content string) (err error)

type Listener

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

func Listen

func Listen(bindAddr string, bindPort int64) (l *Listener, err error)

func (*Listener) Accept

func (l *Listener) Accept() (*Conn, error)

wait util get one new connection or listener is closed if listener is closed, err returned

func (*Listener) Close

func (l *Listener) Close() error

Jump to

Keyboard shortcuts

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