[DEV] add client connection with unique string IP:port
This commit is contained in:
parent
790c165268
commit
19ab3637cf
@ -25,6 +25,17 @@ extern "C" {
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
enet::Tcp enet::connectTcpClient(const etk::String& _config, uint32_t _numberRetry, echrono::Duration _timeOut) {
|
||||||
|
size_t pos = _config.find(':');
|
||||||
|
if (pos == etk::String::npos) {
|
||||||
|
return etk::move(enet::connectTcpClient(_config, 0, _numberRetry, _timeOut));
|
||||||
|
}
|
||||||
|
return etk::move(enet::connectTcpClient(_config.extract(0, pos),
|
||||||
|
etk::string_to_uint16_t(_config.extract(pos+1)),
|
||||||
|
_numberRetry,
|
||||||
|
_timeOut));
|
||||||
|
}
|
||||||
|
|
||||||
enet::Tcp enet::connectTcpClient(uint8_t _ip1, uint8_t _ip2, uint8_t _ip3, uint8_t _ip4, uint16_t _port, uint32_t _numberRetry, echrono::Duration _timeOut) {
|
enet::Tcp enet::connectTcpClient(uint8_t _ip1, uint8_t _ip2, uint8_t _ip3, uint8_t _ip4, uint16_t _port, uint32_t _numberRetry, echrono::Duration _timeOut) {
|
||||||
etk::String tmpname;
|
etk::String tmpname;
|
||||||
tmpname = etk::toString(_ip1);
|
tmpname = etk::toString(_ip1);
|
||||||
|
@ -11,4 +11,5 @@
|
|||||||
namespace enet {
|
namespace enet {
|
||||||
enet::Tcp connectTcpClient(uint8_t _ip1, uint8_t _ip2, uint8_t _ip3, uint8_t _ip4, uint16_t _port, uint32_t _numberRetry=5, echrono::Duration _timeOut = echrono::seconds(1));
|
enet::Tcp connectTcpClient(uint8_t _ip1, uint8_t _ip2, uint8_t _ip3, uint8_t _ip4, uint16_t _port, uint32_t _numberRetry=5, echrono::Duration _timeOut = echrono::seconds(1));
|
||||||
enet::Tcp connectTcpClient(const etk::String& _hostname, uint16_t _port, uint32_t _numberRetry=5, echrono::Duration _timeOut = echrono::seconds(1));
|
enet::Tcp connectTcpClient(const etk::String& _hostname, uint16_t _port, uint32_t _numberRetry=5, echrono::Duration _timeOut = echrono::seconds(1));
|
||||||
|
enet::Tcp connectTcpClient(const etk::String& _config, uint32_t _numberRetry=5, echrono::Duration _timeOut = echrono::seconds(1));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user