1 Star 0 Fork 3

源码大数据(codebigdata)/goWebActualCombat

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
socket-rw-client1.go 842 Bytes
Copy Edit Raw Blame History
ShirDon-廖显东 authored 2021-01-19 21:02 +08:00 . commit
//++++++++++++++++++++++++++++++++++++++++
// 《Go Web编程实战派从入门到精通》源码
//++++++++++++++++++++++++++++++++++++++++
// Author:廖显东(ShirDon)
// Blog:https://www.shirdon.com/
// 仓库地址:https://gitee.com/shirdonl/goWebActualCombat
// 仓库地址:https://github.com/shirdonl/goWebActualCombat
//++++++++++++++++++++++++++++++++++++++++
package main
import (
"fmt"
"log"
"net"
"os"
"time"
)
func main() {
if len(os.Args) <= 1 {
fmt.Println("usage: go run socket-rw-client1.go :... content")
return
}
log.Println("begin dial...")
conn, err := net.Dial("tcp", ":8058")
if err != nil {
log.Println("dial error:", err)
return
}
defer conn.Close()
log.Println("dial ok")
time.Sleep(time.Second * 2)
data := os.Args[1]
conn.Write([]byte(data))
time.Sleep(time.Second * 10000)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/codebigdata/goWebActualCombat.git
git@gitee.com:codebigdata/goWebActualCombat.git
codebigdata
goWebActualCombat
goWebActualCombat
b84124f40e18

Search