func main() { addr, _ := net.ResolveSCTPAddr("sctp", "localhost:4242") conn, _ := net.DialSCTP("sctp", nil, addr) defer conn.Close() message := []byte("paard") conn.WriteToSCTP(message, addr, 55) }
func main() { flag.Parse() addr, err := net.ResolveSCTPAddr("sctp", *settings.Address) if err != nil { println(err) os.Exit(-1) } conn, err := net.DialSCTP("sctp", nil, addr) if err != nil { println("Error listening " + err.Error()) os.Exit(-1) } defer conn.Close() log.Printf("Dialing to %s", *settings.Address) var message = *settings.Message bmessage := []byte(message) for i := 0; i < *settings.Count; i++ { _, err := conn.WriteTo(bmessage, addr) if err != nil { log.Printf("WriteTo error: %v", err) break } } }
func main() { addr, _ := net.ResolveSCTPAddr("sctp", "localhost:4242") conn, err := net.DialSCTP("sctp", nil, addr) if err != nil { print(err) return } defer conn.Close() message := []byte("paarden") _, er2 := conn.WriteToSCTP(message, addr, 4) if er2 != nil { print(er2.Error()) return } conn.WriteToSCTP(message, addr, 3) }
func main() { flag.Parse() addr, err := net.ResolveSCTPAddr("sctp", *settings.Address) if err != nil { println(err) os.Exit(-1) } msg := make([]byte, 2048) conn, err := net.DialSCTP("sctp", nil, addr) if err != nil { println("Error listening " + err.Error()) os.Exit(-1) } defer conn.Close() log.Printf("Dialing to %s", *settings.Address) var message = *settings.Message bmessage := []byte(message) for { // for i := 0; i < 10; i++ { log.Printf("Sending message '%s'", message) _, err := conn.WriteTo(bmessage, addr) if err != nil { log.Printf("WriteTo error: %v", err) break } _, _, err = conn.ReadFrom(msg) if err != nil { println("ReadFrom error") print(err) break } println("Received: " + string(msg)) time.Sleep(1 * 1e9) } }