mirror of
https://gitee.com/johng/gf.git
synced 2024-12-04 21:28:22 +08:00
16 lines
308 B
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())
|
|
}
|
|
} |