Skip to content

Commit

Permalink
Remove unused UDPSocket code.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Jul 1, 2020
1 parent 8edfc62 commit 4dd3969
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
30 changes: 1 addition & 29 deletions UDPSocket.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2006-2016,2020 by Jonathan Naylor G4KLX
* Copyright (C) 2006-2016 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -258,31 +258,3 @@ void CUDPSocket::close()
::close(m_fd);
#endif
}

unsigned long CUDPSocket::getLocalAddress() const
{
unsigned long address = 0UL;

char hostname[80U];
int ret = ::gethostname(hostname, 80);
if (ret == -1)
return 0UL;

struct hostent* phe = ::gethostbyname(hostname);
if (phe == NULL)
return 0UL;

if (phe->h_addrtype != AF_INET)
return 0UL;

for (unsigned int i = 0U; phe->h_addr_list[i] != NULL; i++) {
struct in_addr addr;
::memcpy(&addr, phe->h_addr_list[i], sizeof(struct in_addr));
if (addr.s_addr != INADDR_LOOPBACK) {
address = addr.s_addr;
break;
}
}

return address;
}
4 changes: 1 addition & 3 deletions UDPSocket.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2011,2013,2015,2016,2020 by Jonathan Naylor G4KLX
* Copyright (C) 2009-2011,2013,2015,2016 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -47,8 +47,6 @@ class CUDPSocket {

void close();

unsigned long getLocalAddress() const;

static in_addr lookup(const std::string& hostName);

private:
Expand Down

0 comments on commit 4dd3969

Please sign in to comment.