Skip to content

Commit 6c48a1c

Browse files
committed
Fis the bug causing the error Unable to create socket
1 parent ee94888 commit 6c48a1c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

targetlibs/duo/wiring_api/tcpclient_api.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ void TCPClient_deleteTCPClient(void *tcp_client)
1616
delete ((TCPClient *)tcp_client);
1717
}
1818

19-
int TCPClient_connectByIP(void *tcp_client, uint32_t ip, uint16_t port)
19+
int TCPClient_connectByIP(void *tcp_client, uint8_t *ip, uint16_t port)
2020
{
21-
return ((TCPClient *)tcp_client)->connect(ip, port);
21+
IPAddress remoteIP(ip[0], ip[1], ip[2], ip[3]);
22+
return ((TCPClient *)tcp_client)->connect(remoteIP, port);
2223
}
2324

2425
int TCPClient_connectByHostName(void *tcp_client, const char *host, uint16_t port)

targetlibs/duo/wiring_api/tcpclient_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ typedef struct TCPClient tcp_client;
66
void* TCPClient_newTCPClient(void);
77
void TCPClient_deleteTCPClient(void *tcp_client);
88

9-
int TCPClient_connectByIP(void *tcp_client, uint32_t ip, uint16_t port);
9+
int TCPClient_connectByIP(void *tcp_client, uint8_t *ip, uint16_t port);
1010
int TCPClient_connectByHostName(void *tcp_client, const char *host, uint16_t port);
1111

1212
size_t TCPClient_write(void *tcp_client, uint8_t *buf, size_t size);

0 commit comments

Comments
 (0)