]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/gsockmsw.h
do not require a running event loop, even under MSW, for the sockets to work: if...
[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();
31 ~GSocket();
32 bool IsOk() { return m_ok; }
33 void Close();
34 void Shutdown();
35 GSocketError SetLocal(GAddress *address);
36 GSocketError SetPeer(GAddress *address);
37 GAddress *GetLocal();
38 GAddress *GetPeer();
39 GSocketError SetServer();
40 GSocket *WaitConnection();
41 // not used under MSW
42 void Notify(bool) { }
43 bool SetReusable();
44 bool SetBroadcast();
45 bool DontDoBind();
46 GSocketError Connect(GSocketStream stream);
47 GSocketError SetNonOriented();
48 int Read(char *buffer, int size);
49 int Write(const char *buffer, int size);
50 void SetNonBlocking(bool non_block);
51 void SetTimeout(unsigned long millis);
52 GSocketError WXDLLIMPEXP_NET GetError();
53 void SetCallback(GSocketEventFlags flags,
54 GSocketCallback callback, char *cdata);
55 void UnsetCallback(GSocketEventFlags flags);
56 GSocketError GetSockOpt(int level, int optname,
57 void *optval, int *optlen);
58 GSocketError SetSockOpt(int level, int optname,
59 const void *optval, int optlen);
60
61 void SetInitialSocketBuffers(int recv, int send)
62 {
63 m_initialRecvBufferSize = recv;
64 m_initialSendBufferSize = send;
65 }
66
67 protected:
68 GSocketError Input_Timeout();
69 GSocketError Output_Timeout();
70 GSocketError Connect_Timeout();
71 int Recv_Stream(char *buffer, int size);
72 int Recv_Dgram(char *buffer, int size);
73 int Send_Stream(const char *buffer, int size);
74 int Send_Dgram(const char *buffer, int size);
75
76 /* TODO: Make these protected */
77 public:
78
79 int m_msgnumber;
80 };
81
82 #endif /* _WX_MSW_GSOCKMSW_H_ */