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 (
"github.com/vikpe/udpclient"
)
func main() {
config := udpclient.Config{
BufferSize: 256,
Retries: 0,
TimeoutInMs: 800,
}
udpClient := udpclient.NewWithConfig(config)
}
Output:
func (Client) Request ¶
func (client Client) Request(address string, statusPacket []byte, expectedResponseHeader []byte) ([]byte, error)
Example ¶
package main
import (
"github.com/vikpe/udpclient"
)
func main() {
udpClient := udpclient.New()
statusPacket := []byte{0xff, 0xff, 0xff, 0xff, 's', 't', 'a', 't', 'u', 's', ' ', '2', '3', 0x0a}
expectedHeader := []byte{0xff, 0xff, 0xff, 0xff, 'n', '\\'}
response, err := udpClient.Request(
"qw.foppa.dk:27502",
statusPacket,
expectedHeader,
)
}
Output:
Click to show internal directories.
Click to hide internal directories.