29 send.
join(call,
true);
30 listen.join(call,
false);
32 yCError(FALLBACKNAMECLIENT,
"Multicast not available");
35 std::string msg = std::string(
"NAME_SERVER query ") + nc.
getNamespace();
37 send.
writeLine(msg.c_str(), (
int)msg.length());
40 for (
int i = 0; i < 5; i++) {
42 std::string txt = listen.readLine();
47 yCDebug(FALLBACKNAMECLIENT,
"Fallback name client got %s", txt.c_str());
48 if (txt.find(
"registration ") == 0) {
50 yCInfo(FALLBACKNAMECLIENT,
"Received address %s", address.toURI().c_str());
77 for (
int k = 0; k < tries; k++) {
81 yCInfo(FALLBACKNAMECLIENT,
"Polling for name server (using multicast), try %d of max %d", k + 1, tries);
89 for (
int i0 = 0; i0 < len; i0++) {
90 fprintf(stderr,
"++");
92 fprintf(stderr,
"\n");
94 for (
int i = 0; i < len; i++) {
96 fprintf(stderr,
"++");
98 fprintf(stderr,
"\n");
102 fprintf(stderr,
"\n");
103 yCInfo(FALLBACKNAMECLIENT,
"No response to search for server");
virtual void writeLine(const char *data, int len)
Write some text followed by a line feed.
static void delaySystem(double seconds)
A stream abstraction for datagram communication.
void endPacket() override
Mark the end of a logical packet (see beginPacket).
virtual bool join(const Contact &group, bool sender, const Contact &ipLocal)
void beginPacket() override
Mark the beginning of a logical packet.
void flush() override
Make sure all pending write operations are finished.
A client for the FallbackNameServer class.
static Contact getAddress()
static Contact extractAddress(const std::string &txt)
Extract an address from its text representation.
Small helper class to help deal with legacy YARP configuration files.
std::string getNamespace(bool refresh=false)
int join(double seconds=-1)
#define yCInfo(component,...)
#define yCError(component,...)
#define yCDebug(component,...)
#define YARP_OS_LOG_COMPONENT(name, name_string)
ContainerT::value_type join(typename ContainerT::const_iterator begin, typename ContainerT::const_iterator end, const typename ContainerT::value_type &separator=", ")
Utility to join the elements in a container to a single string separated by a separator.
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.