Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NetClient.h
Go to the documentation of this file.
1 /* Project nGenEx
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: NetEx.lib
6  FILE: NetClient.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Stream-oriented network client class
13 */
14 
15 
16 #ifndef NetClient_h
17 #define NetClient_h
18 
19 #include <windows.h>
20 #include "NetAddr.h"
21 #include "NetGram.h"
22 #include "NetSock.h"
23 #include "List.h"
24 
25 // +-------------------------------------------------------------------+
26 
27 class NetClient
28 {
29 public:
30  static const char* TYPENAME() { return "NetClient"; }
31 
32  NetClient(const NetAddr& server_addr);
33  virtual ~NetClient();
34 
35  int operator == (const NetClient& c) const { return this == &c; }
36 
37  NetAddr GetServerAddr() const { return addr; }
38 
39  bool Send(Text msg);
40  Text Recv();
41  Text SendRecv(Text msg);
42 
43  int GetLastError() const { return err; }
44  DWORD GetTime() const { return delta; }
45 
46 protected:
49  DWORD delta;
50  DWORD time;
51  int err;
52 
53 public:
54  enum ERRS {
55  ERR_INTR = 10004,
56  ERR_BADF = 10009,
57  ERR_ACCES = 10013,
58  ERR_FAULT = 10014,
59  ERR_INVAL = 10022,
60  ERR_MFILE = 10024,
61 
62  ERR_WOULDBLOCK = 10035,
63  ERR_INPROGRESS = 10036,
64  ERR_ALREADY = 10037,
65  ERR_NOTSOCK = 10038,
66  ERR_DESTADDRREQ = 10039,
67  ERR_MSGSIZE = 10040,
68  ERR_PROTOTYPE = 10041,
69  ERR_NOPROTOOPT = 10042,
72  ERR_OPNOTSUPP = 10045,
73  ERR_PFNOSUPPORT = 10046,
74  ERR_AFNOSUPPORT = 10047,
75  ERR_ADDRINUSE = 10048,
77  ERR_NETDOWN = 10050,
78  ERR_NETUNREACH = 10051,
79  ERR_NETRESET = 10052,
80  ERR_CONNABORTED = 10053,
81  ERR_CONNRESET = 10054,
82  ERR_NOBUFS = 10055,
83  ERR_ISCONN = 10056,
84  ERR_NOTCONN = 10057,
85  ERR_SHUTDOWN = 10058,
86  ERR_TOOMANYREFS = 10059,
87  ERR_TIMEDOUT = 10060,
88  ERR_CONNREFUSED = 10061,
89  ERR_LOOP = 10062,
90  ERR_NAMETOOLONG = 10063,
91  ERR_HOSTDOWN = 10064,
92  ERR_HOSTUNREACH = 10065,
93  ERR_NOTEMPTY = 10066,
94  ERR_PROCLIM = 10067,
95  ERR_USERS = 10068,
96  ERR_DQUOT = 10069,
97  ERR_STALE = 10070,
98  ERR_REMOTE = 10071
99  };
100 };
101 
102 
103 #endif NetClient_h