@@ -236,6 +236,7 @@ Go语言中通过net包中的`DialTCP`函数来建立一个TCP连接,并返回
|
||||
"os"
|
||||
"time"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -267,7 +268,7 @@ Go语言中通过net包中的`DialTCP`函数来建立一个TCP连接,并返回
|
||||
|
||||
if read_len == 0 {
|
||||
break // connection already closed by client
|
||||
} else if string(request) == "timestamp" {
|
||||
} else if strings.TrimSpace(string(request[:read_len])) == "timestamp" {
|
||||
daytime := strconv.FormatInt(time.Now().Unix(), 10)
|
||||
conn.Write([]byte(daytime))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user