Create a gist now

Instantly share code, notes, and snippets.

@evanj /tcpping.go Secret
Created Dec 18, 2015

What would you like to do?
tcpping: Send a sequence of plain text messages over TCP
package main
import (
"fmt"
"net"
"os"
"time"
)
func main() {
conn, err := net.Dial("tcp", os.Args[1])
if err != nil {
panic(err)
}
defer conn.Close()
for i := 0; true; i++ {
message := fmt.Sprintf("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa %d\n", i)
_, err = conn.Write([]byte(message))
if err != nil {
panic(err)
}
time.Sleep(time.Second)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment