Documentation ¶
Index ¶
- Variables
- func SendMessage(outchan chan UdpMessage, data []byte, server string, port int)
- func StartRetryUdp(hostName, portNum string, processor func(a, b chan UdpMessage)) (chan UdpMessage, chan UdpMessage)
- func StartUdp(hostName, portNum string, processor func(incoming, outgoing chan UdpMessage)) (chan UdpMessage, chan UdpMessage)
- type UdpMessage
Constants ¶
This section is empty.
Variables ¶
var Qlength int = 2000
Functions ¶
func SendMessage ¶
func SendMessage(outchan chan UdpMessage, data []byte, server string, port int)
SendMessage sends data to server, via outchan. StartUdp passes outchan to the processor function, which is where would normally run SendMessage
func StartRetryUdp ¶
func StartRetryUdp(hostName, portNum string, processor func(a, b chan UdpMessage)) (chan UdpMessage, chan UdpMessage)
This is the UDP connection that retries failed messages. Otherwise, it works exactly like StartUdp. It does not detect duplicate messages, you will have to do that yourself. This is probably the server you want to use.
func StartUdp ¶
func StartUdp(hostName, portNum string, processor func(incoming, outgoing chan UdpMessage)) (chan UdpMessage, chan UdpMessage)
This is the basic UDP connection. It does not support retrying, however it does support sending messages to arbitrary addresses. Please note that the _hostName_ and _portNum_ are the *local* hostname and port number, because this function actually starts a listening server on a local port. Sending messages is a separate function.
You supply the processor function. It must run in a loop, reading from _incoming_, and sending messages to _outgoing_ using the _SendMessage_ function.
The incoming data can be read from packet.Data, after you read the packet from _incoming_.