From 922cb5559b9f2f97279fa24cc9c5862c8b666495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 8 Mar 2005 10:23:43 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r2603, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/iem/iemxmlrpc/; revision=2604 --- xmlrpc++/src/XmlRpcSocket.h | 69 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 xmlrpc++/src/XmlRpcSocket.h (limited to 'xmlrpc++/src/XmlRpcSocket.h') diff --git a/xmlrpc++/src/XmlRpcSocket.h b/xmlrpc++/src/XmlRpcSocket.h new file mode 100644 index 0000000..fa7f950 --- /dev/null +++ b/xmlrpc++/src/XmlRpcSocket.h @@ -0,0 +1,69 @@ +#ifndef _XMLRPCSOCKET_H_ +#define _XMLRPCSOCKET_H_ +// +// XmlRpc++ Copyright (c) 2002-2003 by Chris Morley +// +#if defined(_MSC_VER) +# pragma warning(disable:4786) // identifier was truncated in debug info +#endif + +#ifndef MAKEDEPEND +# include +#endif + +namespace XmlRpc { + + //! A platform-independent socket API. + class XmlRpcSocket { + public: + + //! Creates a stream (TCP) socket. Returns -1 on failure. + static int socket(); + + //! Closes a socket. + static void close(int socket); + + + //! Sets a stream (TCP) socket to perform non-blocking IO. Returns false on failure. + static bool setNonBlocking(int socket); + + //! Read text from the specified socket. Returns false on error. + static bool nbRead(int socket, std::string& s, bool *eof); + + //! Write text to the specified socket. Returns false on error. + static bool nbWrite(int socket, std::string& s, int *bytesSoFar); + + + // The next four methods are appropriate for servers. + + //! Allow the port the specified socket is bound to to be re-bound immediately so + //! server re-starts are not delayed. Returns false on failure. + static bool setReuseAddr(int socket); + + //! Bind to a specified port + static bool bind(int socket, int port); + + //! Set socket in listen mode + static bool listen(int socket, int backlog); + + //! Accept a client connection request + static int accept(int socket); + + + //! Connect a socket to a server (from a client) + static bool connect(int socket, std::string& host, int port); + + + //! Returns last errno + static int getError(); + + //! Returns message corresponding to last error + static std::string getErrorMsg(); + + //! Returns message corresponding to error + static std::string getErrorMsg(int error); + }; + +} // namespace XmlRpc + +#endif -- cgit v1.2.1