connection

package
v0.0.0-...-b0d4320 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	ID string
	// Registerd is true if the connection has received its alias
	Registered bool
	// Alias is the alias of the connection
	Alias string
	// InGame is true if the player is currently in a
	// game, either lobby or actually playing
	InGame bool
	// GameID is the ID of the game the player is in
	GameID string
	// IncommingMessages is the channel through wich messages from the
	// connection come in
	IncommingMessages chan []byte

	// Socket is the net.Conn object
	// the core of the struct
	Socket net.Conn
	// contains filtered or unexported fields
}

Conn is the structure that defines a connection to the server

func NewConnection

func NewConnection(conn net.Conn) *Conn

NewConnection returns an instance of connection. It automatically starts the reader and writer listeners

func (*Conn) Close

func (conn *Conn) Close()

Close kills the reader and writer and closes the TCP connection

func (*Conn) Identification

func (conn *Conn) Identification() string

Identification returns a prefix string to identify a connection whether by its Alias if it is registered or by it's ID if it isn't

func (*Conn) Open

func (conn *Conn) Open()

Open starts the reader and writer for a connection

func (*Conn) Write

func (conn *Conn) Write(message []byte)

write tells the writer to write something to the connection

Jump to

Keyboard shortcuts

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