]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/gsockmsw.h
continuation of GSocket/wxSocket merge: always create GSocket associated to a wxSocke...
[wxWidgets.git] / include / wx / msw / gsockmsw.h
1 /* -------------------------------------------------------------------------
2 * Project: GSocket (Generic Socket) for WX
3 * Name: gsockmsw.h
4 * Copyright: (c) Guilhem Lavaux
5 * Licence: wxWindows Licence
6 * Purpose: GSocket MSW header
7 * CVSID: $Id$
8 * -------------------------------------------------------------------------
9 */
10
11 #ifndef _WX_MSW_GSOCKMSW_H_
12 #define _WX_MSW_GSOCKMSW_H_
13
14 #include "wx/msw/wrapwin.h"
15
16 #if defined(__CYGWIN__)
17 //CYGWIN gives annoying warning about runtime stuff if we don't do this
18 # define USE_SYS_TYPES_FD_SET
19 # include <sys/types.h>
20 #endif
21
22 #if defined(__WXWINCE__) || defined(__CYGWIN__)
23 #include <winsock.h>
24 #endif
25
26 /* Definition of GSocket */
27 class GSocket : public GSocketBase
28 {
29 public:
30 GSocket::GSocket(wxSocketBase& wxsocket)
31 : GSocketBase(wxsocket)
32 {
33 m_msgnumber = 0;
34 }
35
36 virtual void Close();
37
38 virtual GSocket *WaitConnection(wxSocketBase& wxsocket);
39
40
41 GSocketError SetLocal(GAddress *address);
42 GSocketError SetPeer(GAddress *address);
43 GAddress *GetLocal();
44 GAddress *GetPeer();
45 GSocketError SetServer();
46
47 // not used under MSW
48 void Notify(bool) { }
49 bool SetReusable();
50 bool SetBroadcast();
51 bool DontDoBind();
52 GSocketError Connect(GSocketStream stream);
53 GSocketError SetNonOriented();
54 int Read(char *buffer, int size);
55 int Write(const char *buffer, int size);
56 void SetNonBlocking(bool non_block);
57 GSocketError WXDLLIMPEXP_NET GetError();
58 GSocketError GetSockOpt(int level, int optname,
59 void *optval, int *optlen);
60 GSocketError SetSockOpt(int level, int optname,
61 const void *optval, int optlen);
62
63 void SetInitialSocketBuffers(int recv, int send)
64 {
65 m_initialRecvBufferSize = recv;
66 m_initialSendBufferSize = send;
67 }
68
69 protected:
70 GSocketError Input_Timeout();
71 GSocketError Output_Timeout();
72 GSocketError Connect_Timeout();
73 int Recv_Stream(char *buffer, int size);
74 int Recv_Dgram(char *buffer, int size);
75 int Send_Stream(const char *buffer, int size);
76 int Send_Dgram(const char *buffer, int size);
77
78 /* TODO: Make these protected */
79 public:
80
81 int m_msgnumber;
82 };
83
84 #endif /* _WX_MSW_GSOCKMSW_H_ */