sockmsw.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/private/gsockmsw.h
  3. // Purpose: MSW-specific socket implementation
  4. // Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin
  5. // Created: April 1997
  6. // Copyright: (C) 1999-1997, Guilhem Lavaux
  7. // (C) 1999-2000, Guillermo Rodriguez Garcia
  8. // (C) 2008 Vadim Zeitlin
  9. // Licence: wxWindows licence
  10. /////////////////////////////////////////////////////////////////////////////
  11. #ifndef _WX_MSW_GSOCKMSW_H_
  12. #define _WX_MSW_GSOCKMSW_H_
  13. #include "wx/msw/wrapwin.h"
  14. #if defined(__CYGWIN__)
  15. //CYGWIN gives annoying warning about runtime stuff if we don't do this
  16. # define USE_SYS_TYPES_FD_SET
  17. # include <sys/types.h>
  18. #endif
  19. #if defined(__WXWINCE__) || defined(__CYGWIN__)
  20. #include <winsock.h>
  21. #endif
  22. // ----------------------------------------------------------------------------
  23. // MSW-specific socket implementation
  24. // ----------------------------------------------------------------------------
  25. class wxSocketImplMSW : public wxSocketImpl
  26. {
  27. public:
  28. wxSocketImplMSW(wxSocketBase& wxsocket);
  29. virtual ~wxSocketImplMSW();
  30. virtual wxSocketError GetLastError() const;
  31. virtual void ReenableEvents(wxSocketEventFlags WXUNUSED(flags))
  32. {
  33. // notifications are never disabled in this implementation, there is no
  34. // need for this as WSAAsyncSelect() only sends notification once when
  35. // the new data becomes available anyhow, so there is no need to do
  36. // anything here
  37. }
  38. private:
  39. virtual void DoClose();
  40. virtual void UnblockAndRegisterWithEventLoop()
  41. {
  42. // no need to make the socket non-blocking, Install_Callback() will do
  43. // it
  44. wxSocketManager::Get()->Install_Callback(this);
  45. }
  46. int m_msgnumber;
  47. friend class wxSocketMSWManager;
  48. wxDECLARE_NO_COPY_CLASS(wxSocketImplMSW);
  49. };
  50. #endif /* _WX_MSW_GSOCKMSW_H_ */