#ifndef _WX_NETWORK_SOCKET_H
#define _WX_NETWORK_SOCKET_H
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "socket.h"
#endif
#include "wx/sckaddr.h"
#include "wx/gsocket.h"
+#include "wx/list.h"
// ------------------------------------------------------------------------
// Types and constants
// wxSocketBase
// --------------------------------------------------------------------------
-class WXDLLEXPORT wxSocketBase : public wxObject
+class WXDLLIMPEXP_BASE wxSocketBase : public wxObject
{
DECLARE_CLASS(wxSocketBase)
void SetNotify(wxSocketEventFlags flags);
void Notify(bool notify);
+ // initialize/shutdown the sockets (usually called automatically)
+ static bool IsInitialized();
+ static bool Initialize();
+ static void Shutdown();
+
// callbacks are deprecated, use events instead
#if WXWIN_COMPATIBILITY
wxSockCbk Callback(wxSockCbk cbk_);
bool m_notify; // notify events to users?
wxSocketEventFlags m_eventmask; // which events to notify?
+ // the initialization count, GSocket is initialized if > 0
+ static size_t m_countInit;
+
// callbacks are deprecated, use events instead
#if WXWIN_COMPATIBILITY
wxSockCbk m_cbk; // callback
char *m_cdata; // callback data
#endif // WXWIN_COMPATIBILITY
+
+ DECLARE_NO_COPY_CLASS(wxSocketBase)
};
// wxSocketServer
// --------------------------------------------------------------------------
-class WXDLLEXPORT wxSocketServer : public wxSocketBase
+class WXDLLIMPEXP_BASE wxSocketServer : public wxSocketBase
{
DECLARE_CLASS(wxSocketServer)
bool AcceptWith(wxSocketBase& socket, bool wait = TRUE);
bool WaitForAccept(long seconds = -1, long milliseconds = 0);
+
+ DECLARE_NO_COPY_CLASS(wxSocketServer)
};
// wxSocketClient
// --------------------------------------------------------------------------
-class WXDLLEXPORT wxSocketClient : public wxSocketBase
+class WXDLLIMPEXP_BASE wxSocketClient : public wxSocketBase
{
DECLARE_CLASS(wxSocketClient)
virtual bool Connect(wxSockAddress& addr, bool wait = TRUE);
bool WaitOnConnect(long seconds = -1, long milliseconds = 0);
+
+ DECLARE_NO_COPY_CLASS(wxSocketClient)
};
// WARNING: still in alpha stage
-class wxDatagramSocket : public wxSocketBase
+class WXDLLIMPEXP_BASE wxDatagramSocket : public wxSocketBase
{
DECLARE_CLASS(wxDatagramSocket)
/* TODO:
bool Connect(wxSockAddress& addr);
*/
+ DECLARE_NO_COPY_CLASS(wxDatagramSocket)
};
// wxSocketEvent
// --------------------------------------------------------------------------
-class WXDLLEXPORT wxSocketEvent : public wxEvent
+class WXDLLIMPEXP_BASE wxSocketEvent : public wxEvent
{
public:
wxSocketEvent(int id = 0)
wxSocketNotify m_event;
void *m_clientData;
- DECLARE_DYNAMIC_CLASS(wxSocketEvent)
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSocketEvent)
};