|
AndroMeta
2.0.0
|
00001 /* 00002 * Copyright 2009-2012 AndroMeta LLC. All rights reserved. 00003 * 00004 * AndroMeta LLC retains all intellectual property and proprietary 00005 * rights to this software and related documentation and any modifications 00006 * thereto. Any use, reproduction, disclosure, or distribution of this 00007 * software and related documentation without an express license agreement 00008 * from AndroMeta LLC is strictly prohibited. 00009 * 00010 */ 00011 00018 #ifndef ANDROMETA_M_SOCKET_H 00019 #define ANDROMETA_M_SOCKET_H 00020 00021 #include <AndroMeta/MTime.h> 00022 00023 namespace Meta{ 00024 00029 class MSocket{ 00030 public: 00031 00035 MSocket(); 00036 00040 virtual ~MSocket(); 00041 00047 bool connect(const mstr& host, int port); 00048 00053 virtual void onConnect(); 00054 00061 virtual void close(bool manual=true); 00062 00070 int send(char* buf, size_t len); 00071 00079 int send(char* buf, size_t len, const mtime& timeout); 00080 00087 int receive(char* buf, size_t len); 00088 00096 int receive(char* buf, size_t len, const mtime& time); 00097 00101 const mstr& host(); 00102 00106 static bool isLocalHost(const mstr& host); 00107 00108 friend class MSocket_; 00109 00110 private: 00111 MSocket& operator=(const MSocket&); 00112 MSocket(const MSocket&); 00113 00114 class MSocket_* x_; 00115 }; 00116 00117 } // end namespace Meta 00118 00119 #endif // ANDROMETA_M_SOCKET_H
1.7.6.1