Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
func ListenAndServe(net string, addr string, handler func(conn Conn), accept func(conn Conn) bool, closed func(conn Conn, err error), ) error
ListenAndServe creates a new server and binds to addr configured on "tcp" network net.
func ListenAndServeNetwork ¶
func ListenAndServeNetwork( net, laddr string, handler func(conn Conn), accept func(conn Conn) bool, closed func(conn Conn, err error), ) error
ListenAndServeNetwork creates a new server and binds to addr. The network net must be a stream-oriented network: "tcp", "tcp4", "tcp6", "unix" or "unixpacket"
Types ¶
type Conn ¶
type Conn interface { // RemoteAddr returns the remote address of the client connection. RemoteAddr() string // Close closes the connection. Close() error IsClosed() bool Context() interface{} // SetContext sets a user-defined context SetContext(v interface{}) NetConn() net.Conn }
Conn represents a client connection
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server defines a server for clients for managing client connections.
func NewServerNetwork ¶
func NewServerNetwork( net, laddr string, handler func(conn Conn), accept func(conn Conn) bool, closed func(conn Conn, err error)) *Server
NewServerNetwork Create a new web server
func (*Server) ChmodUnixFile ¶
ChmodUnixFile do chmod UNIX bind file
func (*Server) Close ¶
Close stops listening on the TCP address. Already Accepted connections will be closed.
func (*Server) ListenAndServe ¶
ListenAndServe serves incoming connections.
func (*Server) ListenServeAndSignal ¶
ListenServeAndSignal begin listen server and listen signal
func (*Server) RmUnixFile ¶
RmUnixFile do remove UNIX bind file