Created
February 5, 2023 17:55
-
-
Save mstrYoda/75a1ecf966487fac78a3bc5e45d6b2ea to your computer and use it in GitHub Desktop.
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", "127.0.0.1:8080") | |
if err != nil { | |
panic(err) | |
} | |
for { | |
n, err := conn.Write([]byte("hello")) | |
if err != nil { | |
fmt.Println(err) | |
} | |
fmt.Fprintf(os.Stdout, "writted: %d \n", n) | |
time.Sleep(3 * time.Second) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment