fea: openudp: update link state

This commit is contained in:
Daniel Ding
2022-10-07 18:56:06 +08:00
parent f354e6d85f
commit c03c099dfb
12 changed files with 362 additions and 103 deletions

28
pkg/libol/udpin_test.go Normal file
View File

@@ -0,0 +1,28 @@
package libol
import (
"fmt"
"github.com/stretchr/testify/assert"
"testing"
"time"
)
func TestOpenUDP_C(t *testing.T) {
udp := &UdpInServer{Port: 4500}
err := udp.Open()
assert.Equal(t, nil, err, "has not error")
assert.NotEqual(t, -1, udp.Socket, "valid socket")
go func() {
conn, err := udp.Recv()
fmt.Println(conn, err)
}()
err = udp.Send(&UdpInConnection{
Spi: 84209,
RemoteAddr: "180.109.49.146",
RemotePort: 4500,
})
assert.Equal(t, nil, err, "has not error")
time.Sleep(time.Second * 2)
}