stream-server/srt/server.go

28 lines
346 B
Go
Raw Normal View History

2023-09-18 11:51:55 +05:00
package srt
import (
"net"
2023-09-20 15:06:32 +05:00
"fmt"
2023-09-18 11:51:55 +05:00
)
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) {
2023-09-20 15:06:32 +05:00
defer func() {
if r := recover(); r != nil {
fmt.Println(r)
}
}()
2023-09-18 11:51:55 +05:00
intake := NewIntake(l, 1)
for {
intake.Read()
}
}