2024-10-10 07:32:41 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-10-12 11:32:38 +02:00
|
|
|
"fmt"
|
2024-10-10 07:32:41 +02:00
|
|
|
"time"
|
|
|
|
|
2024-11-27 12:32:31 +01:00
|
|
|
"git.qowevisa.me/qowevisa/tcpmachine/tcpclient"
|
2024-10-10 07:32:41 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2024-10-12 11:32:38 +02:00
|
|
|
client := tcpclient.CreateClient("127.0.0.1:10000")
|
2024-10-10 07:32:41 +02:00
|
|
|
go func() {
|
|
|
|
for {
|
|
|
|
if client.IsConnected {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
time.Sleep(100 * time.Millisecond)
|
|
|
|
}
|
|
|
|
for i := 0; i < 10; i++ {
|
|
|
|
client.Server.Write([]byte("PING\n"))
|
|
|
|
time.Sleep(time.Second)
|
2024-10-12 11:33:12 +02:00
|
|
|
client.ErrorsChannel <- fmt.Errorf("test err")
|
2024-10-10 07:32:41 +02:00
|
|
|
}
|
|
|
|
}()
|
2024-10-12 11:32:38 +02:00
|
|
|
err := client.StartClient()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Printf("ERROR: StartClient: %v\n", err)
|
|
|
|
}
|
2024-10-10 07:32:41 +02:00
|
|
|
}
|