Add some sort of auto retry/management for client
This commit is contained in:
18
main.go
18
main.go
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/binary"
|
||||
"log"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"smpptester/client"
|
||||
"smpptester/pdu"
|
||||
@@ -171,14 +172,17 @@ func main() {
|
||||
wg.Add(1)
|
||||
|
||||
client := client.NewSMPPClient("localhost:2775", 1)
|
||||
err := client.Connect()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to connect to SMPP server: %v", err)
|
||||
}
|
||||
err = client.Send(submit)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to send PDU: %v", err)
|
||||
client.Enable()
|
||||
for {
|
||||
if client.Connected {
|
||||
err := client.Send(submit)
|
||||
if err != nil {
|
||||
log.Printf("Failed to send PDU: %v", err)
|
||||
}
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
log.Println("Are we done")
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
Reference in New Issue
Block a user