stream-server/srt/server.go

27 lines
346 B
Go

package srt
import (
"net"
"fmt"
)
func NewServer(port string) (error) {
l, err := net.ListenPacket("udp", ":" + port)
if err != nil {
return err
}
go start(l)
return nil
}
func start(l net.PacketConn) {
defer func() {
if r := recover(); r != nil {
fmt.Println(r)
}
}()
intake := NewIntake(l, 1)
for {
intake.Read()
}
}