BOSS 8.0.0
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 //! Creates a stream (TCP) socket. Returns -1 on failure.
20 static int socket();
21
22 //! Closes a socket.
23 static void close( int socket );
24
25 //! Sets a stream (TCP) socket to perform non-blocking IO. Returns false on failure.
26 static bool setNonBlocking( int socket );
27
28 //! Read text from the specified socket. Returns false on error.
29 static bool nbRead( int socket, std::string& s, bool* eof );
30
31 //! Write text to the specified socket. Returns false on error.
32 static bool nbWrite( int socket, std::string& s, int* bytesSoFar );
33
34 // The next four methods are appropriate for servers.
35
36 //! Allow the port the specified socket is bound to to be re-bound immediately so
37 //! server re-starts are not delayed. Returns false on failure.
38 static bool setReuseAddr( int socket );
39
40 //! Bind to a specified port
41 static bool bind( int socket, int port );
42
43 //! Set socket in listen mode
44 static bool listen( int socket, int backlog );
45
46 //! Accept a client connection request
47 static int accept( int socket );
48
49 //! Connect a socket to a server (from a client)
50 static bool connect( int socket, std::string& host, int port );
51
52 //! Returns last errno
53 static int getError();
54
55 //! Returns message corresponding to last error
56 static std::string getErrorMsg();
57
58 //! Returns message corresponding to error
59 static std::string getErrorMsg( int error );
60 };
61
62} // namespace XmlRpc
63
64#endif
XmlRpcServer s
A platform-independent socket API.
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.