SCTP in Go

Rejoice! There seem to be some interest in my SCTP in Go coding project. After reading some positive comments on Reddit I decided to pick up the work where I left it.

The current state of the project is a bare minimum implementation of the protocol in Go 1.6 in my Github account together with some examples. My first task will be to get it working in Go 1.7.

Here a small preview of a SCTP client written in Go:

package main
import (
	"log"
	"os"
	"net"
)

func main() {

	saddr := "127.0.0.1:4242"
	addr, err := net.ResolveSCTPAddr("sctp", saddr)
	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()

	var message = "hello"
	bmessage := []byte(message)

	_, err = conn.WriteTo(bmessage, addr)
	if err != nil {
		log.Printf("WriteTo error: %v", err)
	}

}

 

More info about SCTP in Go can be found in my paper I published for my talk at the 2013 AsiaBSD conference or a video recording of the talk I gave at the 2012 EuroBSD conference.

Advertisements