-
-
Save evanj/4329312f5e27fd34ba90 to your computer and use it in GitHub Desktop.
tcpping: Send a sequence of plain text messages over TCP
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" | |
"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