server

package
v0.0.0-...-e9cd1b1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package server provides server functionality for the Chat application

Package server provides server functionality for the Chat application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields

} // }}}

Server holds private information related to the server

func New

func New(ip string, port int) *Server

New initializes and returns a new Server.

func (*Server) Connect

func (s *Server) Connect(destination, port string) error

Connect attempts to establish a new connection, returning an error should anything go wrong

func (*Server) Exit

func (s *Server) Exit()

Exit exits the program, closing any established connections prior to doing so

func (*Server) List

func (s *Server) List()

List lists the IP addresses and port numbers associated with all currently established connections

func (*Server) Listen

func (s *Server) Listen()

Listen uses the servers listener to continuously accept incoming TCP connections

func (*Server) Send

func (s *Server) Send(conn int, message string) error

Send attempts to send a given message to the connection associated with the given connection id, returning an error should anything go wrong

func (*Server) SetApplication

func (s *Server) SetApplication(app types.Application)

SetApplication sets the application of the server, since we make the server prior to making the application

func (*Server) Terminate

func (s *Server) Terminate(conn int) error

Terminate terminates the connection associated with the given connection id, returning an error should anything go wrong

Jump to

Keyboard shortcuts

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