Skip to content

Commit d612d18

Browse files
committed
espressif: Socket: pass correct family & type in connect, sendto
Otherwise, it was not possible to interact with a v6 address, as `lwip_getaddrinfo` wouldn't resolve it.
1 parent eaa6f99 commit d612d18

File tree

1 file changed

+4
-4
lines changed
  • ports/espressif/common-hal/socketpool

1 file changed

+4
-4
lines changed

ports/espressif/common-hal/socketpool/Socket.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,8 @@ void common_hal_socketpool_socket_close(socketpool_socket_obj_t *self) {
377377
void common_hal_socketpool_socket_connect(socketpool_socket_obj_t *self,
378378
const char *host, size_t hostlen, uint32_t port) {
379379
const struct addrinfo hints = {
380-
.ai_family = AF_INET,
381-
.ai_socktype = SOCK_STREAM,
380+
.ai_family = self->family,
381+
.ai_socktype = self->type,
382382
};
383383
struct addrinfo *result_i;
384384
int error = lwip_getaddrinfo(host, NULL, &hints, &result_i);
@@ -607,8 +607,8 @@ mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *self,
607607

608608
// Set parameters
609609
const struct addrinfo hints = {
610-
.ai_family = AF_INET,
611-
.ai_socktype = SOCK_STREAM,
610+
.ai_family = self->family,
611+
.ai_socktype = self->type,
612612
};
613613
struct addrinfo *result_i;
614614
int error = lwip_getaddrinfo(host, NULL, &hints, &result_i);

0 commit comments

Comments
 (0)