diff --git a/rtl8720dn/netdriver.go b/rtl8720dn/netdriver.go index 73e6cc4..629b491 100644 --- a/rtl8720dn/netdriver.go +++ b/rtl8720dn/netdriver.go @@ -71,10 +71,13 @@ func (d *Driver) ConnectTCPSocket(addr, port string) error { name[6] = byte(ipaddr[2]) name[7] = byte(ipaddr[3]) - _, err = d.Rpc_lwip_connect(socket, name, uint32(len(name))) + result, err := d.Rpc_lwip_connect(socket, name, uint32(len(name))) if err != nil { return err } + if result == -1 { + return fmt.Errorf("failed to connect to %d.%d.%d.%d port %s", addr[0], addr[1], addr[2], addr[3], port) + } readset := []byte{} writeset := []byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}