Created
December 23, 2011 13:40
-
-
Save mcroydon/1514236 to your computer and use it in GitHub Desktop.
Simplest finger client possible in go.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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