本文整理匯總了Golang中github.com/antongulenko/RTP/protocols.Server.Errors方法的典型用法代碼示例。如果您正苦於以下問題:Golang Server.Errors方法的具體用法?Golang Server.Errors怎麽用?Golang Server.Errors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/antongulenko/RTP/protocols.Server
的用法示例。
在下文中一共展示了Server.Errors方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: startLoadClient
func startLoadClient() (port int) {
port = start_rtp_port
var server *protocols.Server
var stats *load.LoadStats
for {
var err error
server, err = protocols.NewServer(net.JoinHostPort(rtp_ip, strconv.Itoa(port)), load.MiniProtocol)
if err != nil {
log.Printf("Failed to start Load server on port %v: %v", port, err)
port += 2
continue
}
stats, err = load.RegisterServer(server)
if err != nil {
log.Printf("Failed to register Load server on port %v: %v", port, err)
port += 2
continue
}
if print_load_packets {
stats.Handler = func(packet *load.LoadPacket) {
packet.PrintReceived()
}
}
break
}
tasks.AddNamed("client", server)
go func() {
for err := range server.Errors() {
log.Println("Error receiving Load:", err)
}
}()
log.Printf("Listening on %v UDP port %v for Load\n", rtp_ip, port)
statistics = append(statistics, stats.Received)
statistics = append(statistics, stats.Missed)
return
}
示例2: printServerErrors
func printServerErrors(servername string, server *protocols.Server) {
for err := range server.Errors() {
log.Println(servername + " error: " + err.Error())
}
}
示例3: printErrors
func printErrors(server *protocols.Server) {
for err := range server.Errors() {
log.Println("Server error: " + err.Error())
}
}