--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -243,6 +243,9 @@ static const int err_to_errno_table[] = {
   set_errno(sk->err); \
 } while (0)
 
+/* function to notify libc about a socket event */
+extern void (*libc_select_notify)();
+
 /* Forward delcaration of some functions */
 static void event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len);
 static void lwip_getsockopt_internal(void *arg);
@@ -1316,7 +1319,7 @@ return_copy_fdsets:
  * Processes recvevent (data available) and wakes up tasks waiting for select.
  */
 static void
-event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
+orig_event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
 {
   int s;
   struct lwip_sock *sock;
@@ -1431,6 +1434,17 @@ again:
   SYS_ARCH_UNPROTECT(lev);
 }
 
+/* Wrapper for the original event_callback() function that additionally calls
+ * libc_select_notify()
+ */
+static void
+event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
+{
+       orig_event_callback(conn, evt, len);
+       if (libc_select_notify)
+               libc_select_notify();
+}
+
 /**
  * Unimplemented: Close one end of a full-duplex connection.
  * Currently, the full connection is closed.
