[DEV] add the remote name connected to the TCP element IP:port
This commit is contained in:
parent
19ab3637cf
commit
34bd74c67f
@ -53,12 +53,13 @@ enet::Tcp::Tcp() :
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __TARGET_OS__Windows
|
#ifdef __TARGET_OS__Windows
|
||||||
enet::Tcp::Tcp(SOCKET _idSocket, const etk::String& _name) :
|
enet::Tcp::Tcp(SOCKET _idSocket, const etk::String& _name, const etk::String& _remoteName) :
|
||||||
#else
|
#else
|
||||||
enet::Tcp::Tcp(int32_t _idSocket, const etk::String& _name) :
|
enet::Tcp::Tcp(int32_t _idSocket, const etk::String& _name, const etk::String& _remoteName) :
|
||||||
#endif
|
#endif
|
||||||
m_socketId(_idSocket),
|
m_socketId(_idSocket),
|
||||||
m_name(_name),
|
m_name(_name),
|
||||||
|
m_remoteName(_remoteName),
|
||||||
m_status(status::link) {
|
m_status(status::link) {
|
||||||
#ifdef ENET_STORE_INPUT
|
#ifdef ENET_STORE_INPUT
|
||||||
m_nodeStoreInput = etk::FSNode("CACHE:StoreTCPdata_" + etk::toString(baseID++) + ".tcp");
|
m_nodeStoreInput = etk::FSNode("CACHE:StoreTCPdata_" + etk::toString(baseID++) + ".tcp");
|
||||||
@ -69,6 +70,7 @@ enet::Tcp::Tcp() :
|
|||||||
enet::Tcp::Tcp(Tcp&& _obj) :
|
enet::Tcp::Tcp(Tcp&& _obj) :
|
||||||
m_socketId(_obj.m_socketId),
|
m_socketId(_obj.m_socketId),
|
||||||
m_name(_obj.m_name),
|
m_name(_obj.m_name),
|
||||||
|
m_remoteName(_obj.m_remoteName),
|
||||||
m_status(_obj.m_status) {
|
m_status(_obj.m_status) {
|
||||||
#ifdef ENET_STORE_INPUT
|
#ifdef ENET_STORE_INPUT
|
||||||
m_nodeStoreInput = etk::FSNode("CACHE:StoreTCPdata_" + etk::toString(baseID++) + ".tcp");
|
m_nodeStoreInput = etk::FSNode("CACHE:StoreTCPdata_" + etk::toString(baseID++) + ".tcp");
|
||||||
|
16
enet/Tcp.hpp
16
enet/Tcp.hpp
@ -34,9 +34,9 @@ namespace enet {
|
|||||||
public:
|
public:
|
||||||
Tcp();
|
Tcp();
|
||||||
#ifdef __TARGET_OS__Windows
|
#ifdef __TARGET_OS__Windows
|
||||||
Tcp(SOCKET _idSocket, const etk::String& _name);
|
Tcp(SOCKET _idSocket, const etk::String& _name, const etk::String& _remoteName="");
|
||||||
#else
|
#else
|
||||||
Tcp(int32_t _idSocket, const etk::String& _name);
|
Tcp(int32_t _idSocket, const etk::String& _name, const etk::String& _remoteName="");
|
||||||
#endif
|
#endif
|
||||||
// move constructor
|
// move constructor
|
||||||
Tcp(Tcp&& _obj);
|
Tcp(Tcp&& _obj);
|
||||||
@ -52,9 +52,19 @@ namespace enet {
|
|||||||
* @brief Get the decriptive name hot the host:port
|
* @brief Get the decriptive name hot the host:port
|
||||||
* @return the string requested
|
* @return the string requested
|
||||||
*/
|
*/
|
||||||
const etk::String& getName() {
|
const etk::String& getName() const {
|
||||||
return m_name;
|
return m_name;
|
||||||
}
|
}
|
||||||
|
private:
|
||||||
|
etk::String m_remoteName; //!< remote IP:port.
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Get the decriptive name hot the host:port
|
||||||
|
* @return the string requested
|
||||||
|
*/
|
||||||
|
const etk::String& getRemoteName() const {
|
||||||
|
return m_remoteName;
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
enum class status {
|
enum class status {
|
||||||
unlink,
|
unlink,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user