Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Config Config
}
func NewWithConfig ¶
Example ¶
package main
import (
"fmt"
"github.com/vikpe/udpclient"
)
func main() {
config := udpclient.Config{
BufferSize: 256,
Retries: 0,
TimeoutInMs: 800,
}
client := udpclient.NewWithConfig(config)
fmt.Print(client.Config)
}
Output:
func (Client) SendCommand ¶ added in v0.1.2
Example ¶
package main
import (
"fmt"
"github.com/vikpe/udpclient"
)
func main() {
client := udpclient.New()
command := udpclient.Command{
RequestPacket: []byte{0xff, 0xff, 0xff, 0xff, 's', 't', 'a', 't', 'u', 's', ' ', '2', '3', 0x0a},
ResponseHeader: []byte{0xff, 0xff, 0xff, 0xff, 'n', '\\'},
}
response, err := client.SendCommand("qw.foppa.dk:27502", command)
fmt.Println(response, err)
}
Output:
func (Client) SendPacket ¶ added in v0.1.2
Example ¶
package main
import (
"fmt"
"github.com/vikpe/udpclient"
)
func main() {
client := udpclient.New()
statusPacket := []byte{0xff, 0xff, 0xff, 0xff, 's', 't', 'a', 't', 'u', 's', ' ', '2', '3', 0x0a}
response, err := client.SendPacket("qw.foppa.dk:27502", statusPacket)
fmt.Println(response, err)
}
Output:
Click to show internal directories.
Click to hide internal directories.