mirror of
https://github.com/oe7drt/YSFClients.git
synced 2026-04-05 14:25:44 +00:00
convert bindaddr from const char * to std::string
This commit is contained in:
parent
c214bbfd89
commit
0a9ce3e450
5 changed files with 10 additions and 10 deletions
|
|
@ -102,7 +102,7 @@ in_addr CUDPSocket::lookup(const std::string& hostname)
|
|||
#endif
|
||||
}
|
||||
|
||||
bool CUDPSocket::open(const char* bindaddr)
|
||||
bool CUDPSocket::open(const std::string& bindaddr)
|
||||
{
|
||||
m_fd = ::socket(PF_INET, SOCK_DGRAM, 0);
|
||||
if (m_fd < 0) {
|
||||
|
|
@ -120,10 +120,10 @@ bool CUDPSocket::open(const char* bindaddr)
|
|||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(m_port);
|
||||
|
||||
if ( strlen(bindaddr) > 0){
|
||||
int validaddr = inet_pton(AF_INET, bindaddr, &(addr.sin_addr));
|
||||
if ( bindaddr.length() > 0){
|
||||
int validaddr = inet_pton(AF_INET, bindaddr.c_str(), &(addr.sin_addr));
|
||||
if (validaddr != 1){
|
||||
LogError("The BindAddress in the .ini is invalid - %s", bindaddr);
|
||||
LogError("The BindAddress in the .ini is invalid - %s", bindaddr.c_str());
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue