/* Cid is the connection id (socket fd) and state can be: 0 - Closed by remote server or error 1 - Connected to remote server 2 - Listening  */
MODEM_CMD_DEFINE(on_urc_castate)
/* Cid is the connection id (socket fd) and state can be: 0 - Closed by remote server or error 1 - Connected to remote server 2 - Listening  */
MODEM_CMD_DEFINE(on_urc_castate)
{
	struct modem_socket *sock;
	int sockfd, state;
	sockfd = atoi(argv[0]);
	state = atoi(argv[1]);
	sock = modem_socket_from_fd(&mdata.socket_config, sockfd);
	if (!sock) {
		return 0;
	}
	if (state != 0) {
		return 0;
	}
	LOG_INF("Socket close indication for socket: %d", sockfd);
	sock->is_connected = false;
	LOG_INF("Socket closed: %d", sockfd);
	return 0;
}