23 this->ackVariant = ackVariant;
44 if (header.
length() == 8) {
45 std::string target = getSpecifierName();
46 for (
int i = 0; i < 8; i++) {
47 if (!(target[i] == header.
get()[i])) {
58 if (header.
length() == 8) {
59 std::string target = getSpecifierName();
60 for (
int i = 0; i < 8; i++) {
61 header.
get()[i] = target[i];
89 std::string target = getSpecifierName();
92 std::string from =
proto.getSenderSpecifier();
98 return proto.os().isOk();
105 std::string result =
proto.is().readLine();
115 proto.setRoute(route);
135 std::string from =
"<ACK>\r\n";
136 Bytes b2((
char*)from.c_str(), from.length());
140 return proto.os().isOk();
147 std::string result =
proto.is().readLine();
154 std::string from =
"Welcome ";
155 from +=
proto.getRoute().getFromName();
160 return proto.os().isOk();
A mini-server for performing network communication in the background.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
A simple abstraction for a block of bytes.
A base class for connection types (tcp, mcast, shmem, ...) which are called carriers in YARP.
The basic state of a connection - route, streams in use, etc.
Information about a connection between two ports.
void setFromName(const std::string &fromName)
Set the source of the route.
Minimal requirements for an efficient Writer.
Communicating between two ports via a plain-text protocol.
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
bool sendAck(ConnectionState &proto) override
Send an acknowledgement, if needed for this carrier.
bool expectAck(ConnectionState &proto) override
Receive an acknowledgement, if expected for this carrier.
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
bool sendIndex(ConnectionState &proto, SizedWriter &writer) override
bool expectIndex(ConnectionState &proto) override
Expect a message header, if there is one for this carrier.
bool isTextMode() const override
Check if carrier is textual in nature.
Carrier * create() const override
Factory method.
bool respondToHeader(ConnectionState &proto) override
Respond to the header.
bool checkHeader(const Bytes &header) override
Given the first 8 bytes received on a connection, decide if this is the right carrier type to use for...
bool sendHeader(ConnectionState &proto) override
Write a header appropriate to the carrier to the connection, followed by any carrier-specific data.
bool expectSenderSpecifier(ConnectionState &proto) override
Expect the name of the sending port.
bool supportReply() const override
This flag is used by YARP to determine whether the connection can carry RPC traffic,...
TextCarrier(bool ackVariant=false)
void getHeader(Bytes &header) const override
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to se...
virtual std::string getSpecifierName() const
bool expectReplyToHeader(ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
#define yCDebug(component,...)
#define YARP_OS_LOG_COMPONENT(name, name_string)
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.