mirror of
https://gitee.com/johng/gf.git
synced 2024-12-05 05:37:55 +08:00
18 lines
295 B
Go
18 lines
295 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/gogf/gf/g/net/gtcp"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
data, err := gtcp.SendRecv("www.baidu.com:80", []byte("HEAD / HTTP/1.1\n\n"), -1)
|
|
if len(data) > 0 {
|
|
fmt.Println(string(data))
|
|
}
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err.Error())
|
|
}
|
|
}
|