摘要:
1. http server package main import ( "fmt" "net/http" ) func main() { // 请求url和对应处理函数 http.HandleFunc("/hello", myHandleFunc) // 开启服务 http.ListenAndSe 阅读全文
摘要:
1. udp server package main import ( "fmt" "net" ) func main() { // udp server listenUdp, err := net.ListenUDP("udp", &net.UDPAddr{ IP: net.IPv4(127,0, 阅读全文
摘要:
1. tcp server package main import ( "bufio" "fmt" "net" ) func main() { // 1. 监听端口 listener, err := net.Listen("tcp", "127.0.0.1:8080") if err != nil 阅读全文