Skip to content

Instantly share code, notes, and snippets.

@7yan00
Last active August 29, 2015 14:19
Show Gist options
  • Save 7yan00/980a4e56a137e6ee66af to your computer and use it in GitHub Desktop.
Save 7yan00/980a4e56a137e6ee66af to your computer and use it in GitHub Desktop.
gopher
package main
import (
"fmt"
"io/ioutil"
"net"
)
func main() {
conn, err := net.Dial("tcp", "gopher.quux.org:70")
if err != nil {
panic(err)
}
_, err = conn.Write([]byte("\r\n"))
if err != nil {
panic(err)
}
fmt.Println(conn)
bytes, err := ioutil.ReadAll(conn)
if err != nil {
panic(err)
}
fmt.Println(string(bytes))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment