CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
XmlRpcSocket.h
Go to the documentation of this file.
1#ifndef _XMLRPCSOCKET_H_
2#define _XMLRPCSOCKET_H_
3//
4// XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
5//
6#if defined(_MSC_VER)
7# pragma warning(disable:4786) // identifier was truncated in debug info
8#endif
9
10#ifndef MAKEDEPEND
11# include <string>
12#endif
13
14namespace XmlRpc {
15
16 //! A platform-independent socket API.
18 public:
19
20 //! Creates a stream (TCP) socket. Returns -1 on failure.
21 static int socket();
22
23 //! Closes a socket.
24 static void close(int socket);
25
26
27 //! Sets a stream (TCP) socket to perform non-blocking IO. Returns false on failure.
28 static bool setNonBlocking(int socket);
29
30 //! Read text from the specified socket. Returns false on error.
31 static bool nbRead(int socket, std::string& s, bool *eof);
32
33 //! Write text to the specified socket. Returns false on error.
34 static bool nbWrite(int socket, std::string& s, int *bytesSoFar);
35
36
37 // The next four methods are appropriate for servers.
38
39 //! Allow the port the specified socket is bound to to be re-bound immediately so
40 //! server re-starts are not delayed. Returns false on failure.
41 static bool setReuseAddr(int socket);
42
43 //! Bind to a specified port
44 static bool bind(int socket, int port);
45
46 //! Set socket in listen mode
47 static bool listen(int socket, int backlog);
48
49 //! Accept a client connection request
50 static int accept(int socket);
51
52
53 //! Connect a socket to a server (from a client)
54 static bool connect(int socket, std::string& host, int port);
55
56
57 //! Returns last errno
58 static int getError();
59
60 //! Returns message corresponding to last error
61 static std::string getErrorMsg();
62
63 //! Returns message corresponding to error
64 static std::string getErrorMsg(int error);
65 };
66
67} // namespace XmlRpc
68
69#endif
XmlRpcServer s
Definition: HelloServer.cpp:11
A platform-independent socket API.
Definition: XmlRpcSocket.h:17
static int socket()
Creates a stream (TCP) socket. Returns -1 on failure.
static bool listen(int socket, int backlog)
Set socket in listen mode.
static int getError()
Returns last errno.
static int accept(int socket)
Accept a client connection request.
static bool nbWrite(int socket, std::string &s, int *bytesSoFar)
Write text to the specified socket. Returns false on error.
static bool setReuseAddr(int socket)
static bool connect(int socket, std::string &host, int port)
Connect a socket to a server (from a client)
static bool setNonBlocking(int socket)
Sets a stream (TCP) socket to perform non-blocking IO. Returns false on failure.
static void close(int socket)
Closes a socket.
static bool nbRead(int socket, std::string &s, bool *eof)
Read text from the specified socket. Returns false on error.
static bool bind(int socket, int port)
Bind to a specified port.
static std::string getErrorMsg()
Returns message corresponding to last error.
Definition: XmlRpc.h:35