PageRenderTime 67ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/utilities/xmlrpcpp/include/XmlRpcSocket.h

https://gitlab.com/F34140r/ros_comm
C Header | 80 lines | 30 code | 28 blank | 22 comment | 0 complexity | 98d7ecca6783069961883a99a389f4f1 MD5 | raw file
Possible License(s): LGPL-2.1
  1. // this file modified by Morgan Quigley on 22 Apr 2008.
  2. // added features: server can be opened on port 0 and you can read back
  3. // what port the OS gave you
  4. #ifndef _XMLRPCSOCKET_H_
  5. #define _XMLRPCSOCKET_H_
  6. //
  7. // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
  8. //
  9. #if defined(_MSC_VER)
  10. # pragma warning(disable:4786) // identifier was truncated in debug info
  11. #endif
  12. #ifndef MAKEDEPEND
  13. # include <string>
  14. #endif
  15. #include "XmlRpcDecl.h"
  16. namespace XmlRpc {
  17. //! A platform-independent socket API.
  18. class XMLRPCPP_DECL XmlRpcSocket {
  19. public:
  20. static bool s_use_ipv6_;
  21. //! Creates a stream (TCP) socket. Returns -1 on failure.
  22. static int socket();
  23. //! Closes a socket.
  24. static void close(int socket);
  25. //! Sets a stream (TCP) socket to perform non-blocking IO. Returns false on failure.
  26. static bool setNonBlocking(int socket);
  27. //! Read text from the specified socket. Returns false on error.
  28. static bool nbRead(int socket, std::string& s, bool *eof);
  29. //! Write text to the specified socket. Returns false on error.
  30. static bool nbWrite(int socket, std::string& s, int *bytesSoFar);
  31. // The next four methods are appropriate for servers.
  32. //! Allow the port the specified socket is bound to to be re-bound immediately so
  33. //! server re-starts are not delayed. Returns false on failure.
  34. static bool setReuseAddr(int socket);
  35. //! Bind to a specified port
  36. static bool bind(int socket, int port);
  37. static int get_port(int socket);
  38. //! Set socket in listen mode
  39. static bool listen(int socket, int backlog);
  40. //! Accept a client connection request
  41. static int accept(int socket);
  42. //! Connect a socket to a server (from a client)
  43. static bool connect(int socket, std::string& host, int port);
  44. //! Returns last errno
  45. static int getError();
  46. //! Returns message corresponding to last error
  47. static std::string getErrorMsg();
  48. //! Returns message corresponding to error
  49. static std::string getErrorMsg(int error);
  50. };
  51. } // namespace XmlRpc
  52. #endif