tcp_server

package
v0.0.0-...-b2d2da7 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONN_HOST = "localhost"
	CONN_PORT = "5309"
	CONN_TYPE = "tcp"
)

Variables

This section is empty.

Functions

func DispatchResults

func DispatchResults(conn net.Conn, res api.Response)

Dispatch results to the proper client

func HandleRequest

func HandleRequest(conn net.Conn, reqch chan api.Request, resch chan api.Response)

When we get a request, parse the msgpack'd data and send it to the API server

func ParseRequest

func ParseRequest(data []byte) api.Request

Decode raw bytes into an API Request

func ReadFull

func ReadFull(conn net.Conn) []byte

Read a full TCP request, up until the terminating seqeunce

func StartTCPServer

func StartTCPServer(reqch chan api.Request, resch chan api.Response)

The TCP Server listens for client connections, parses the msgpack'd data, and sends the request to the API server

Types

type Client

type Client struct {
	// Did the Client send the proper initialization request?
	Initialized bool

	// Is the client connected?
	Connected bool

	// Hooks the client is listening for
	Hooks string
}

type Server

type Server struct {
	Clients []Client
}

Jump to

Keyboard shortcuts

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