2008-11-28 12:47:07 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/msw/gsockmsw.h
|
|
|
|
// Purpose: MSW-specific socket implementation
|
|
|
|
// Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia, Vadim Zeitlin
|
|
|
|
// Created: April 1997
|
|
|
|
// Copyright: (C) 1999-1997, Guilhem Lavaux
|
|
|
|
// (C) 1999-2000, Guillermo Rodriguez Garcia
|
|
|
|
// (C) 2008 Vadim Zeitlin
|
|
|
|
// RCS_ID: $Id$
|
|
|
|
// License: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-09-07 15:20:51 +00:00
|
|
|
|
2007-12-19 16:45:08 +00:00
|
|
|
#ifndef _WX_MSW_GSOCKMSW_H_
|
|
|
|
#define _WX_MSW_GSOCKMSW_H_
|
1999-09-07 15:20:51 +00:00
|
|
|
|
2004-08-03 03:33:36 +00:00
|
|
|
#include "wx/msw/wrapwin.h"
|
1999-09-15 00:02:49 +00:00
|
|
|
|
2005-04-10 06:33:26 +00:00
|
|
|
#if defined(__CYGWIN__)
|
|
|
|
//CYGWIN gives annoying warning about runtime stuff if we don't do this
|
|
|
|
# define USE_SYS_TYPES_FD_SET
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__WXWINCE__) || defined(__CYGWIN__)
|
2008-11-28 12:47:07 +00:00
|
|
|
#include <winsock.h>
|
2005-02-10 14:55:27 +00:00
|
|
|
#endif
|
|
|
|
|
2008-11-28 12:47:07 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// MSW-specific socket implementation
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxSocketImplMSW : public wxSocketImpl
|
1999-09-07 15:20:51 +00:00
|
|
|
{
|
2004-08-03 03:33:36 +00:00
|
|
|
public:
|
2008-11-28 12:47:07 +00:00
|
|
|
wxSocketImplMSW(wxSocketBase& wxsocket);
|
|
|
|
|
|
|
|
virtual ~wxSocketImplMSW();
|
|
|
|
|
|
|
|
virtual wxSocketImpl *WaitConnection(wxSocketBase& wxsocket);
|
|
|
|
|
|
|
|
|
2008-12-25 18:29:08 +00:00
|
|
|
int Read(void *buffer, int size);
|
|
|
|
int Write(const void *buffer, int size);
|
2008-11-28 12:47:07 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
virtual wxSocketError DoHandleConnect(int ret);
|
|
|
|
virtual void DoClose();
|
|
|
|
|
|
|
|
virtual void UnblockAndRegisterWithEventLoop()
|
2008-11-23 13:12:46 +00:00
|
|
|
{
|
2008-11-28 12:47:07 +00:00
|
|
|
// no need to make the socket non-blocking, Install_Callback() will do
|
|
|
|
// it
|
|
|
|
wxSocketManager::Get()->Install_Callback(this);
|
2008-11-23 13:12:46 +00:00
|
|
|
}
|
|
|
|
|
2008-11-28 12:47:07 +00:00
|
|
|
wxSocketError Connect_Timeout();
|
2008-12-25 18:29:08 +00:00
|
|
|
int Recv_Stream(void *buffer, int size);
|
|
|
|
int Recv_Dgram(void *buffer, int size);
|
|
|
|
int Send_Stream(const void *buffer, int size);
|
|
|
|
int Send_Dgram(const void *buffer, int size);
|
2008-11-28 12:47:07 +00:00
|
|
|
|
|
|
|
int m_msgnumber;
|
|
|
|
|
|
|
|
friend class wxSocketMSWManager;
|
1999-09-07 15:20:51 +00:00
|
|
|
|
2008-11-28 12:47:07 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxSocketImplMSW)
|
1999-09-07 15:20:51 +00:00
|
|
|
};
|
|
|
|
|
2007-12-19 16:45:08 +00:00
|
|
|
#endif /* _WX_MSW_GSOCKMSW_H_ */
|