use non-blocking recv() function from libnetconf
diff --git a/src/mod_netconf.c b/src/mod_netconf.c
index f2e8a03..22d213d 100644
--- a/src/mod_netconf.c
+++ b/src/mod_netconf.c
@@ -357,6 +357,29 @@
  */
 
 /**
+ * \brief Send RPC and wait for reply with timeout.
+ *
+ * \param[in] session libnetconf session
+ * \param[in] rpc     prepared RPC message
+ * \param[in] timeout timeout in miliseconds, -1 for blocking, 0 for non-blocking
+ * \param[out] reply  reply from the server
+ * \return Value from nc_session_recv_reply() or NC_MSG_UNKNOWN when send_rpc() fails.
+ * On success, it returns NC_MSG_REPLY.
+ */
+NC_MSG_TYPE netconf_send_recv_timed(struct nc_session *session, nc_rpc *rpc,
+					   int timeout, nc_reply **reply)
+{
+	const nc_msgid msgid = NULL;
+	NC_MSG_TYPE ret = NC_MSG_UNKNOWN;
+	msgid = nc_session_send_rpc(session, rpc);
+	if (msgid == NULL) {
+		return ret;
+	}
+	ret = nc_session_recv_reply(session, timeout, reply);
+	return ret;
+}
+
+/**
  * \brief Connect to NETCONF server
  *
  * \warning Session_key hash is not bound with caller identification. This could be potential security risk.
@@ -599,7 +622,7 @@
 
 	if (session != NULL) {
 		/* send the request and get the reply */
-		msgt = nc_session_send_recv(session, rpc, &reply);
+		msgt = netconf_send_recv_timed(session, rpc, 5000, &reply);
 		/* process the result of the operation */
 		return netconf_test_reply(session, NULL, msgt, reply, NULL);
 	} else {
@@ -670,7 +693,7 @@
 		locked_session->last_activity = apr_time_now();
 
 		/* send the request and get the reply */
-		msgt = nc_session_send_recv(session, rpc, &reply);
+		msgt = netconf_send_recv_timed(session, rpc, 5000, &reply);
 
 		/* first release exclusive lock for this session */
 		DEBUG("UNLOCK mutex %s", __func__);
diff --git a/src/mod_netconf.h b/src/mod_netconf.h
index 2e8951a..0f9bf79 100644
--- a/src/mod_netconf.h
+++ b/src/mod_netconf.h
@@ -150,5 +150,8 @@
 void clean_err_reply();
 void free_err_reply();
 
+NC_MSG_TYPE netconf_send_recv_timed(struct nc_session *session, nc_rpc *rpc,
+					   int timeout, nc_reply **reply);
+
 #endif