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();
135 std::string from =
"<ACK>\r\n";
136 Bytes b2((
char*)from.c_str(), from.length());
154 std::string from =
"Welcome ";
155 from += proto.
getRoute().getFromName();
A mini-server for performing network communication in the background.
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.
OutputStream & os()
Shorthand for getOutputStream()
virtual const Route & getRoute() const =0
Get the route associated with this connection.
virtual std::string getSenderSpecifier() const =0
Extract a name for the sender, if the connection type supports that.
InputStream & is()
Shorthand for getInputStream()
virtual void setRoute(const Route &route)=0
Set the route associated with this connection.
virtual void flush()
Make sure all pending write operations are finished.
virtual bool isOk() const =0
Check if the stream is ok or in an error state.
virtual void write(char ch)
Write a single byte to the stream.
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.