mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-22 07:29:01 +00:00
rtl8720dn: add handling when connect fails
This commit is contained in:
@@ -71,10 +71,13 @@ func (d *Driver) ConnectTCPSocket(addr, port string) error {
|
|||||||
name[6] = byte(ipaddr[2])
|
name[6] = byte(ipaddr[2])
|
||||||
name[7] = byte(ipaddr[3])
|
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 {
|
if err != nil {
|
||||||
return err
|
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{}
|
readset := []byte{}
|
||||||
writeset := []byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
|
writeset := []byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
|
||||||
|
|||||||
Reference in New Issue
Block a user