How to set a udp socket peer connect timeout?

Using the latest nRF_Connect_SDK

How can we set a udp/dtls socket, peer connect timeout for this call:

//** zsock_connect - connect socket to peer network
	//** https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.0/zephyr/connectivity/networking/api/sockets.html
	err = connect(client_fd, (struct sockaddr *)&host_addr, sizeof(struct sockaddr_in));
	if (err < 0) {
		printk("Connect failed : %d\n", errno);
		goto error;
	}
	else {
		DBG_PRINTF("Server Connected\r\n");
	}

If there is no way to set a timeout for the call itself, is there a way to abort the call? Then a separate timeout can be set.

Thanks.

Related