34 return connect(yarp_address);
46 m_LocalAddress = toContact(ok, host, port);
47 m_RemoteAddress = m_LocalAddress;
58 bool ok = m_Acceptor.
accept(m_Socket);
71 m_LocalAddress = toContact(ok, host, port);
73 m_RemoteAddress = toContact(ok, host, port);
76 if (!m_Socket.
recvAll(&recv_conn_data,
sizeof recv_conn_data)) {
82 if (!in.
open(m_RemoteAddress.
getPort(), &m_Socket)) {
95 send_conn_data.
command = ACKNOWLEDGE;
96 send_conn_data.
size = 0;
97 if (!m_Socket.
sendAll(&send_conn_data,
sizeof send_conn_data)) {
125 m_LocalAddress = toContact(ok, host, port);
127 m_RemoteAddress = toContact(ok, host, port);
136 send_conn_data.
command = CONNECT;
138 if (!m_Socket.
sendAll(&send_conn_data,
sizeof send_conn_data)) {
145 if (!m_Socket.
recvAll(&recv_conn_data,
sizeof recv_conn_data)) {
151 if (!in.
open(m_RemoteAddress.
getPort(), &m_Socket)) {
207 return m_bLinked && in.
isOk() && out.
isOk();
226 return m_LocalAddress;
231 return m_RemoteAddress;
const yarp::os::LogComponent & SHMEMCARRIER()
#define SHMEM_DEFAULT_SIZE
void write(const yarp::os::Bytes &b) override
Write a block of bytes to the stream.
void reset() override
Reset the stream.
yarp::os::OutputStream & getOutputStream() override
Get an OutputStream to write to.
void interrupt() override
Interrupt the stream.
virtual ~ShmemHybridStream()
int open(const yarp::os::Contact &yarp_address, bool sender)
bool isOk() const override
Check if the stream is ok or in an error state.
const yarp::os::Contact & getRemoteAddress() const override
Get the address of the remote side of the stream.
void beginPacket() override
Mark the beginning of a logical packet.
const yarp::os::Contact & getLocalAddress() const override
Get the address of the local side of the stream.
void endPacket() override
Mark the end of a logical packet (see beginPacket).
yarp::os::InputStream & getInputStream() override
Get an InputStream to read from.
void close() override
Terminate the stream.
bool write(const yarp::os::Bytes &b)
bool open(int port, int size=4096)
bool recvAll(void *data, size_t len)
Receive exactly len bytes (blocking socket)
bool accept(Socket &stream)
Accept a connection on a listening socket.
bool connect(const std::string &host, int port)
bool listen(int port)
Listen on all the interfaces (port 0 means any free port)
bool sendAll(const void *data, size_t len)
Send exactly len bytes (blocking socket)
bool getRemoteAddress(std::string &host, int &port) const
bool getLocalAddress(std::string &host, int &port) const
A simple abstraction for a block of bytes.
Simple specification of the minimum functions needed from output streams.
#define yCError(component,...)
#define yCDebug(component,...)
The main, catch-all namespace for YARP.