From 8898ad9b25fca6afe2374d293a981db02a83d7e9 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Thu, 31 May 2012 14:46:27 +0000 Subject: Committing the documentation to svn to have it accessible online --- Doc/doxygen/html/_net_client_8cpp_source.html | 233 ++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 Doc/doxygen/html/_net_client_8cpp_source.html (limited to 'Doc/doxygen/html/_net_client_8cpp_source.html') diff --git a/Doc/doxygen/html/_net_client_8cpp_source.html b/Doc/doxygen/html/_net_client_8cpp_source.html new file mode 100644 index 0000000..adb3f36 --- /dev/null +++ b/Doc/doxygen/html/_net_client_8cpp_source.html @@ -0,0 +1,233 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/NetEx/NetClient.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
NetClient.cpp
+
+
+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.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Network Server Pump for HTTP Server
+
13 */
+
14 
+
15 
+
16 #include "MemDebug.h"
+
17 #include "NetClient.h"
+
18 #include "NetHost.h"
+
19 #include "NetLayer.h"
+
20 #include <mmsystem.h>
+
21 
+
22 // +-------------------------------------------------------------------+
+
23 
+
24 NetClient::NetClient(const NetAddr& server_addr)
+
25  : addr(server_addr), sock(0), delta(0), time(0), err(0)
+
26 {
+
27 }
+
28 
+ +
30 {
+
31  delete sock;
+
32 }
+
33 
+
34 // +--------------------------------------------------------------------+
+
35 
+
36 bool
+ +
38 {
+
39  if (msg.length() > 0) {
+
40  if (sock)
+
41  delete sock;
+
42 
+
43  sock = new(__FILE__,__LINE__) NetSock(addr, true);
+
44  delta = 0;
+
45  time = timeGetTime();
+
46 
+
47  if (!sock) {
+
48  err = ERR_NOBUFS;
+
49  return false;
+
50  }
+
51 
+
52  err = sock->send(msg);
+
53  if (err < 0) {
+ +
55  return false;
+
56  }
+
57 
+ +
59  if (err < 0) {
+ +
61  return false;
+
62  }
+
63 
+
64  return true;
+
65  }
+
66 
+
67  else {
+
68  delete sock;
+
69  sock = 0;
+
70  }
+
71 
+
72  return false;
+
73 }
+
74 
+
75 Text
+ +
77 {
+
78  Text response;
+
79 
+
80  if (sock) {
+
81  int ready = sock->select();
+
82 
+
83  while (!ready && timeGetTime() - time < 2000) {
+
84  Sleep(5);
+
85  ready = sock->select();
+
86  }
+
87 
+
88  if (ready) {
+
89  Text msg = sock->recv();
+
90 
+
91  while (msg.length() > 0) {
+
92  response += msg;
+
93  msg = sock->recv();
+
94  }
+
95 
+
96  delta = timeGetTime() - time;
+
97  }
+
98 
+
99  delete sock;
+
100  sock = 0;
+
101  }
+
102 
+
103  return response;
+
104 }
+
105 
+
106 Text
+ +
108 {
+
109  Text response;
+
110 
+
111  if (msg.length() > 0 && Send(msg)) {
+
112  response = Recv();
+
113  }
+
114 
+
115  return response;
+
116 }
+
+
+ + + + -- cgit v1.1