Added UDP multicast for plugin discovery (#153)
* Added Timer * Added UDPSocket::GetAddr * Added MessageHandlers::SendBeacon() * PoC of starting a timer on PluginEnable * C++11 * Added Timer to xcode project * C++11 in cmake * added Timer to cmake * use function pointer in Timer * moved Timer to namespace + wait for thread to join when stopping the timer * Windows: changed uint to unisgned short * Windows: Added Timer.h/cpp to project * GetAddr static * Send xplane and plugin version with BECN * SendBeacon with params * fixed file copyrights * Include functional to fix Linux compile error * review fixes * Send plugin receive port in BECN * review fixes
This commit is contained in:
committed by
Jason Watkins
parent
f9bfd6e3b9
commit
50335c4a5c
@@ -138,6 +138,18 @@ namespace XPC
|
||||
Log::FormatLine(LOG_INFO, tag, "Send succeeded. (remote: %s)", GetHost(remote).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
sockaddr UDPSocket::GetAddr(std::string address, unsigned short port)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_addr.s_addr = inet_addr(address.c_str());
|
||||
addr.sin_port = htons(port);
|
||||
|
||||
sockaddr* sa = reinterpret_cast<sockaddr*>(&addr);
|
||||
return *sa;
|
||||
}
|
||||
|
||||
std::string UDPSocket::GetHost(sockaddr* sa)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user