chat

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxClientSize = 50
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func CreateClient

func CreateClient(conn net.Conn) *Client

func (*Client) Close

func (self *Client) Close()

func (*Client) GetIncoming

func (self *Client) GetIncoming() Message

func (*Client) GetName

func (self *Client) GetName() string

func (*Client) Quit

func (self *Client) Quit()

func (*Client) SendMsg

func (self *Client) SendMsg(msg string)

发送消息

func (*Client) SetName

func (self *Client) SetName(name string)

func (*Client) StartPoll

func (self *Client) StartPoll()

type ClientTable

type ClientTable map[net.Conn]*Client

保存连接信息

type Message

type Message chan string

type Server

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

func CreateServer

func CreateServer() *Server

func (*Server) Start

func (self *Server) Start(bindAddr string)

func (*Server) Stop

func (self *Server) Stop()

FIXME: need to figure out if this is the correct approach to gracefully terminate a server.

Jump to

Keyboard shortcuts

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