hbpvis / servus Goto Github PK
View Code? Open in Web Editor NEWZeroconf discovery in C++
License: Other
Zeroconf discovery in C++
License: Other
List of discovered instances contains host names as xxx.local names, it would be very convenient to get the IP address of the host.
I am trying to use the Servus lib in a test app.
On windows i face the following issue
when i use find_package(Servus REQUIRED) in cmake file i get Servus_FOUND but the
Servus_INCLUDE_DIRS do no get populated.
on building i get
fatal error C1083: Cannot open include file: 'servus/servus.h': No such file or directory
However if i manually add the include DIRS to the cmake file am able to build and use servus in the app.
any idea how can i get it to work using just find_package()?
Hello,
I'm trying to compile a static lib of Servus (or any type of lib for that matter..), but when I build it with cmake and then ninja (or vs 2017 x64), I don't find any generated lib file.
Do I miss a step ? Is there something missing in the readme to actually create a .lib (and header files as well) ?
What's strange is I remember having already done that last year, but I can't remember how and I'm stuck without knowing where to look...
Infos :
Thanks
The LGPLv3 license text should be included in the released package.
Submodule cmake-common from the Eyescale should be included in the release tar.gz package, otherwise it's quite hard to package it downstream. I am trying to get this package into Fedora.
libServus.so.1.6.0
libServus.so.6
It's due to:
project(Servus VERSION 1.6.0)
set(Servus_VERSION_ABI 6)
I think it's strange:
I ran into this issue on macOS, in an application running a large number of sockets.
dnssd/servus.h
sources use select() API calls inside of _handleEvents()
. This only works well until the file descriptor reaches FD_SETSIZE
. There is an error checking code for a valid file descriptor, but this code does not consider the fact that fd
can be larger than zero and still invalid:
assert(fd >= 0);
if (fd < 0)
return servus::Servus::Result(kDNSServiceErr_BadParam);
To continue using select()
API call, one would need to check for it to be lower than FD_SETSIZE
, but a better fix would be to switch to using poll()
and WSAPoll()
API calls.
I just tried using Servus as a git submodule
, but CMake happily refuses to configure with:
CMake Error: Could not open file for write in copy operation .../Servus/.git/hooks/pre-commit.tmp
CMake Error: : System Error: Not a directory
CMake Error at CMake/common/GitHooks.cmake:18 (configure_file):
configure_file Problem configuring file
Call Stack (most recent call first):
CMake/common/Common.cmake:152 (include)
CMakeLists.txt:35 (include)
and indeed: Servus/.git
is not a directory, but is a file, referencing the parent repository.
I figure this is actually a problem in https://github.com/Eyescale/CMake
on un*x-systems, cmake --install
will install to /usr
by default.
i think this is really harmful, as the expected place is /usr/local
, and on typical Linux distributions /usr
is reserved for package-manager-installed software.
this again seems to be a problem with the CMake/common
snippets.
As of this commit. Since we're in C++11, why not just use basic_regex?
now that i've started digging into Servus, it turns out that you cannot discover the port
of a service.
e.g. in avahi.h, the uint16_t
field which denotes the service port is simply unused:
Lines 313 to 318 in 1f3514e
now i'm not an expert when it comes to ZeroConf, but in my understanding the port information is crucial for service discovery (at least this is what i gather than you always must provide a port when announcing a service; also, i don't know how one would actually reach a service without knowing both the host-address and the port).
have i been misusing Zeroconf, or is this just a weird omittance?
I'd suggest using the servus_port
key for this information (though i admit i wonder why Servus would reserve any key (e.g. servus_host
) for private use for obligatory information (like host-address, host-port, service-name and service-type))
Hi,
It works on android and ios?
Thanks.
It has GUI application (servusBrowser), so it should have .desktop file.
Attached is the .desktop file we used in Fedora downstream (just drop the .txt suffix, due to stupid github).
servus.desktop.txt
I simply followed the build steps:
git clone https://github.com/HBPVIS/Servus.git
mkdir Servus/build
cd Servus/build
cmake -GNinja ..
ninja
➜ build git:(master) cmake -GNinja ..
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such ascmake_minimum_required(VERSION 3.5)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.-- Configuring incomplete, errors occurred!
➜ build git:(master) cmake -GNinja .. -Wno-dev
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
➜ build git:(master)
It would be very nice to have a "Debug Static" and "Release Static" configuration to generate a static lib.
Some distros e.g. Fedora uses /usr/lib64, do not hardcode /usr/lib, but detect it.
LGPLv3 requires license text to be delivered with the code, please add it to the repository, e.g.: https://www.gnu.org/licenses/lgpl-3.0.txt
I try to compile servus on a ubuntu 16.04 VM using following commands .
cmake ..
make
during cmake step following message gets logged
-- Servus [1.5.1-7-g059f391-dirty] without avahi-client
it seems that cmake is unable to find the avahi package.
Can you please let me know the step i need to take so that servus compiles with avahi-client
Fixed by adding <stdexcept.h> into Servus/servus/serializable.h
[sbanks@ys]~/git/ZeroBuf/build% make
Scanning dependencies of target Servus
[ 5%] Building CXX object Servus/servus/CMakeFiles/Servus.dir/version.cpp.o
[ 10%] Building CXX object Servus/servus/CMakeFiles/Servus.dir/md5/md5.cc.o
[ 15%] Building CXX object Servus/servus/CMakeFiles/Servus.dir/serializable.cpp.o
In file included from /home/sbanks/git/ZeroBuf/Servus/servus/serializable.cpp:20:
/home/sbanks/git/ZeroBuf/Servus/servus/serializable.h: In member function ‘virtual bool servus::Serializable::_fromBinary(const void*, size_t)’:
/home/sbanks/git/ZeroBuf/Servus/servus/serializable.h:135:20: error: ‘runtime_error’ is not a member of ‘std’
135 | throw std::runtime_error("Binary deserialization not implemented");
| ^~~~~~~~~~~~~
/home/sbanks/git/ZeroBuf/Servus/servus/serializable.h:136:5: error: no return statement in function returning non-void [-Werror=return-type]
136 | }
Hello,
I've been using getaddrinfo() to resolve IP from hostname, but the problem is that getaddrinfo() doesn't allow for specifying a network interface, and multiple devices with same hostname on different interfaces will not work with this method.
I couldn't find a generic method to work around this problem, except implementing the Bonjour / Avahi API.
DNSServiceGetAddrInfo allows to do that and it would make the library very powerful and complete to have that inside, especially since Bonjour and Avahi already have those methods ready to use.
I have tried myself but the callback of DNSServiceGetAddrInfo was never triggered, I'm not sure why but if someone has more insight on this this would be great !a
Requires changes on the SerializeCallback and DeserializeCallback to have either return values or in-out parameters with enum for error code and an optional error message. This way, applications can add error reporting that is eventually transported to an HTTP client for instance.
namespace servus
{
...
// in the spirit of HTTP status codes
enum class Status
{
OK,
BAD_REQUEST,
...
}
struct Response
{
Status status = OK;
std::string message;
}
typedef std::function< void( Response& ) > DeserializedCallback;
typedef std::function< void( Response& ) > SerializeCallback;
}
Here's what I do:
-DCOMMON_LIBRARY_TYPE=STATIC
libavahi-client-dev
packageBonjour 4 Windows 3.0 SDK
, which gets manually installed as C:\Program Files/Bonjour SDK
and which is declared when building Servus via `-DDNSSD_DIR="C:\Program Files/Bonjour SDK"}cmake --install
/usr/local
(in order to workaround #111, the install path is manually set to this directory)/usr
C:/Program Files (x86)/Servus
find_package(Servus REQUIRED)
CMake Warning at C:/msys64/mingw32/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
By not providing "FindDNSSD.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "DNSSD", but
CMake did not find one.
Could not find a package configuration file provided by "DNSSD" with any of
the following names:
DNSSDConfig.cmake
dnssd-config.cmake
Add the installation prefix of "DNSSD" to CMAKE_PREFIX_PATH or set
"DNSSD_DIR" to a directory containing one of the above files. If "DNSSD"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
C:/Program Files (x86)/Servus/Servus/CMake/ServusConfig.cmake:11 (find_dependency)
CMakeLists.txt:17 (find_package)
CMake Warning at CMakeLists.txt:17 (find_package):
Found package configuration file:
C:/Program Files (x86)/Servus/Servus/CMake/ServusConfig.cmake
but it set Servus_FOUND to FALSE so package "Servus" is considered to be
NOT FOUND. Reason given by package:
Servus could not be found because dependency DNSSD could not be found.
CMake Debug Log at CMakeLists.txt:17 (find_package):
C:/Program Files (x86)/Servus/Servus/CMake/ServusConfig.cmake
of course i set the DNSSD_DIR
(to the same value as when building Servus itself) but this doesn't help.
CMake Warning at /usr/local/Cellar/cmake/3.22.2/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
By not providing "FindDNSSD.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "DNSSD", but
CMake did not find one.
Could not find a package configuration file provided by "DNSSD" with any of
the following names:
DNSSDConfig.cmake
dnssd-config.cmake
Add the installation prefix of "DNSSD" to CMAKE_PREFIX_PATH or set
"DNSSD_DIR" to a directory containing one of the above files. If "DNSSD"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
/usr/local/share/Servus/CMake/ServusConfig.cmake:11 (find_dependency)
CMakeLists.txt:17 (find_package)
CMake Warning at CMakeLists.txt:17 (find_package):
Found package configuration file:
/usr/local/share/Servus/CMake/ServusConfig.cmake
but it set Servus_FOUND to FALSE so package "Servus" is considered to be
NOT FOUND. Reason given by package:
Servus could not be found because dependency DNSSD could not be found.
CMake Warning at /usr/share/cmake-3.25/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
By not providing "Findavahi-client.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"avahi-client", but CMake did not find one.
Could not find a package configuration file provided by "avahi-client" with
any of the following names:
avahi-clientConfig.cmake
avahi-client-config.cmake
Add the installation prefix of "avahi-client" to CMAKE_PREFIX_PATH or set
"avahi-client_DIR" to a directory containing one of the above files. If
"avahi-client" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
/usr/share/Servus/CMake/ServusConfig.cmake:11 (find_dependency)
CMakeLists.txt:17 (find_package)
CMake Warning at CMakeLists.txt:17 (find_package):
Found package configuration file:
/usr/share/Servus/CMake/ServusConfig.cmake
but it set Servus_FOUND to FALSE so package "Servus" is considered to be
NOT FOUND. Reason given by package:
Servus could not be found because dependency avahi-client could not be
found.
neither bonjour nor avahi-client ship a Cmake-snippet.
I guess this is the reason why CMake fails to mark these dependencies as FOUND
and thus (wrongly) concludes that Servus_FOUND
ought to be 0
as well.
Sidenote: I also tried with find_package(Servus CONFIG)
, but that didn't help either...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.