Commit 849c9098 authored by barnettZQG's avatar barnettZQG

add server delay

parent 431d0881
Pipeline #755 failed with stages
......@@ -9,8 +9,8 @@ import (
)
func main() {
address := "106.15.152.33:27065"
//address := "127.0.0.1:8080"
//address := "106.15.152.33:27061"
address := "127.0.0.1:8080"
udpAddr, err := net.ResolveUDPAddr("udp", address)
con, err := net.DialUDP("udp", nil, udpAddr)
if err != nil {
......
......@@ -4,6 +4,7 @@ import (
"fmt"
"net"
"os"
"time"
"github.com/sirupsen/logrus"
)
......@@ -21,6 +22,7 @@ func udpProcess(conn *net.UDPConn, index int) {
}
str := string(data[:n])
fmt.Println("receive from client, data:" + str)
time.Sleep(time.Second * 30)
conn.WriteToUDP([]byte(fmt.Sprintf("server receive: %s", str)), rAddr)
<-limitChan
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment