xiaoxiang781216 commented on code in PR #8297:
URL: https://github.com/apache/nuttx/pull/8297#discussion_r1089350957


##########
net/tcp/tcp_conn.c:
##########
@@ -1242,7 +1242,14 @@ int tcp_connect(FAR struct tcp_conn_s *conn, FAR const 
struct sockaddr *addr)
 
       /* The sockaddr address is 32-bits in network order. */
 
-      net_ipv4addr_copy(conn->u.ipv4.raddr, inaddr->sin_addr.s_addr);
+      if (inaddr->sin_addr.s_addr == INADDR_ANY)
+        {
+          net_ipv4addr_copy(conn->u.ipv4.raddr, HTONL(INADDR_LOOPBACK));
+        }
+      else
+        {
+          net_ipv4addr_copy(conn->u.ipv4.raddr, inaddr->sin_addr.s_addr);
+        }

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to