+#ifdef __WXMAC__
+
+extern "C" int updatestatus(int s) ;
+
+void wxMacSocketOnRequestProc( void *refcon , short event )
+{
+ if ( refcon )
+ {
+ wxSocketBase *sock = (wxSocketBase *) refcon ;
+
+ wxSocketBase::wxRequestEvent sk_req;
+
+ int canRead ;
+ int canWrite ;
+ int exception ;
+
+ switch (event) {
+ case FD_READ:
+ sk_req = wxSocketBase::EVT_READ;
+ sock->OnRequest(sk_req);
+ break;
+ case FD_WRITE:
+ sk_req = wxSocketBase::EVT_WRITE;
+ sock->OnRequest(sk_req);
+ break;
+ case FD_CLOSE:
+ sk_req = wxSocketBase::EVT_LOST;
+ sock->OnRequest(sk_req);
+ break;
+ case FD_ACCEPT:
+ sk_req = wxSocketBase::EVT_ACCEPT;
+ sock->OnRequest(sk_req);
+ break;
+ case FD_CONNECT:
+ sk_req = wxSocketBase::EVT_CONNECT;
+ sock->OnRequest(sk_req);
+ break;
+ case FD_READY :
+ break ;
+ }
+ updatestatus ( sock->m_fd ) ;
+ }
+}
+
+void wxMacSocketHandlerProc( void *refcon , short event )
+{
+ wxMacNetEventsReferences[wxMacNetEventsTop] = refcon ;
+ wxMacNetEventsEvents[wxMacNetEventsTop] = event ;
+
+ // clumsy construct in order to never have a incorrect wxMacNetEventsTop (above limits)
+
+ if ( wxMacNetEventsTop + 1 == kwxMacNetEventsMax )
+ wxMacNetEventsTop = 0 ;
+ else
+ wxMacNetEventsTop++ ;
+}
+
+#endif