22 lines
264 B
Go
22 lines
264 B
Go
|
package srt
|
||
|
|
||
|
import (
|
||
|
"net"
|
||
|
)
|
||
|
|
||
|
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) {
|
||
|
intake := NewIntake(l, 1)
|
||
|
for {
|
||
|
intake.Read()
|
||
|
}
|
||
|
}
|