gf/geg/net/gtcp/gtcp_func.go

16 lines
308 B
Go

package main
import (
"gitee.com/johng/gf/g/net/gtcp"
"fmt"
)
func main() {
data, err := gtcp.SendRecv("www.baidu.com:80", []byte("GET / HTTP/1.1\n\n"), -1)
if len(data) > 0 {
fmt.Println(string(data))
}
if err != nil {
fmt.Errorf("ERROR: %s\n", err.Error())
}
}