golang的net包
package net import "net" net包提供了可移植的网络I/O接口,包括TCP/IP、UDP、域名解析和Unix域socket。 虽然本包提供了对网络原语的访问,大部分使用者只需要Dial、Listen和Accept函数提供的基本接口;以及相关的Conn和Listener接口。crypto/tls包提供了相同的接口和类似的Dial和Listen函数。 Dial函数和服务端建立连接: conn, err := net.Dial("tcp", "google.com:80") if err != nil { // handle error } fmt.Fprintf(conn, "GET / HTTP/1.0\r\n\r\n") status, err := bufio.Ne...阅读全文