]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/msw/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 | // RCS_ID: $Id$ | |
10 | // License: wxWindows licence | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | ||
14 | #ifndef _WX_MSW_GSOCKMSW_H_ | |
15 | #define _WX_MSW_GSOCKMSW_H_ | |
16 | ||
17 | #include "wx/msw/wrapwin.h" | |
18 | ||
19 | #if defined(__CYGWIN__) | |
20 | //CYGWIN gives annoying warning about runtime stuff if we don't do this | |
21 | # define USE_SYS_TYPES_FD_SET | |
22 | # include <sys/types.h> | |
23 | #endif | |
24 | ||
25 | #if defined(__WXWINCE__) || defined(__CYGWIN__) | |
26 | #include <winsock.h> | |
27 | #endif | |
28 | ||
29 | // ---------------------------------------------------------------------------- | |
30 | // MSW-specific socket implementation | |
31 | // ---------------------------------------------------------------------------- | |
32 | ||
33 | class wxSocketImplMSW : public wxSocketImpl | |
34 | { | |
35 | public: | |
36 | wxSocketImplMSW(wxSocketBase& wxsocket); | |
37 | ||
38 | virtual ~wxSocketImplMSW(); | |
39 | ||
40 | virtual wxSocketImpl *WaitConnection(wxSocketBase& wxsocket); | |
41 | ||
42 | ||
43 | int Read(char *buffer, int size); | |
44 | int Write(const char *buffer, int size); | |
45 | ||
46 | private: | |
47 | virtual wxSocketError DoHandleConnect(int ret); | |
48 | virtual void DoClose(); | |
49 | ||
50 | virtual void UnblockAndRegisterWithEventLoop() | |
51 | { | |
52 | // no need to make the socket non-blocking, Install_Callback() will do | |
53 | // it | |
54 | wxSocketManager::Get()->Install_Callback(this); | |
55 | } | |
56 | ||
57 | wxSocketError Input_Timeout(); | |
58 | wxSocketError Output_Timeout(); | |
59 | wxSocketError Connect_Timeout(); | |
60 | int Recv_Stream(char *buffer, int size); | |
61 | int Recv_Dgram(char *buffer, int size); | |
62 | int Send_Stream(const char *buffer, int size); | |
63 | int Send_Dgram(const char *buffer, int size); | |
64 | ||
65 | int m_msgnumber; | |
66 | ||
67 | friend class wxSocketMSWManager; | |
68 | ||
69 | DECLARE_NO_COPY_CLASS(wxSocketImplMSW) | |
70 | }; | |
71 | ||
72 | #endif /* _WX_MSW_GSOCKMSW_H_ */ |