rtl8720dn: add examples/rtl8720dn/tcpclient

This commit is contained in:
sago35
2021-07-23 16:17:02 +09:00
committed by Ron Evans
parent 58106b5942
commit a0119ffc6f
3 changed files with 199 additions and 3 deletions
+7 -3
View File
@@ -32,9 +32,13 @@ func (r *RTL8720DN) ConnectTCPSocket(addr, port string) error {
}
ipaddr := make([]byte, 4)
_, err := r.Rpc_netconn_gethostbyname(addr, &ipaddr)
if err != nil {
return err
if len(addr) == 4 {
copy(ipaddr, addr)
} else {
_, err := r.Rpc_netconn_gethostbyname(addr, &ipaddr)
if err != nil {
return err
}
}
portNum, err := strconv.ParseUint(port, 0, 0)