fix: access: setEther raise crash on darwin.

This commit is contained in:
Daniel Ding
2022-12-08 19:22:47 +08:00
parent 8e4d541cfe
commit 181c18466e
3 changed files with 23 additions and 19 deletions

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)
}