Skip to content

Instantly share code, notes, and snippets.

@mcroydon
Created December 23, 2011 13:40
Show Gist options
  • Save mcroydon/1514236 to your computer and use it in GitHub Desktop.
Save mcroydon/1514236 to your computer and use it in GitHub Desktop.
Simplest finger client possible in go.
package main
import (
"fmt"
"net"
"io/ioutil"
)
func main() {
// Create connection
conn, _ := net.Dial("tcp", "mit.edu"+":79")
// Close connection when we're done
defer conn.Close()
// Request default report (blank line <CR><LF>
conn.Write([]byte("\r\n"))
// Read response in to buffer
mess, _ := ioutil.ReadAll(conn)
// Print response
fmt.Printf("%s", mess)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment