Skip to content

Instantly share code, notes, and snippets.

@evanj

evanj/tcpping.go Secret

Created December 18, 2015 18:16
Show Gist options
  • Save evanj/4329312f5e27fd34ba90 to your computer and use it in GitHub Desktop.
Save evanj/4329312f5e27fd34ba90 to your computer and use it in GitHub Desktop.
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