24 ACE_INET_Addr ace_address(yarp_address.
getPort(), yarp_address.
getHost().c_str());
27 return connect(ace_address);
29 ACE_INET_Addr ace_server_addr(ace_address.get_port_number());
31 int result = m_Acceptor.open(ace_server_addr);
38 m_Acceptor.get_local_addr(ace_server_addr);
40 m_LocalAddress =
yarp::os::Contact(ace_server_addr.get_host_addr(), ace_server_addr.get_port_number());
41 m_RemoteAddress = m_LocalAddress;
63 ACE_INET_Addr local, remote;
64 m_SockStream.get_local_addr(local);
65 m_SockStream.get_remote_addr(remote);
66 m_LocalAddress =
yarp::os::Contact(local.get_host_addr(), local.get_port_number());
67 m_RemoteAddress =
yarp::os::Contact(remote.get_host_addr(), remote.get_port_number());
70 result = m_SockStream.recv_n(&recv_conn_data,
sizeof recv_conn_data);
77 if (!in.
open(m_RemoteAddress.
getPort(), &m_SockStream)) {
90 send_conn_data.
command = ACKNOWLEDGE;
91 if (m_SockStream.send_n(&send_conn_data,
sizeof send_conn_data) <= 0) {
99 m_SockStream.enable(ACE_NONBLOCK);
104int ShmemHybridStream::connect(
const ACE_INET_Addr& ace_address)
110 ACE_SOCK_Connector connector;
118 ACE_INET_Addr
local, remote;
119 m_SockStream.get_local_addr(local);
120 m_SockStream.get_remote_addr(remote);
122 m_RemoteAddress =
yarp::os::Contact(remote.get_host_addr(), remote.get_port_number());
127 send_conn_data.
command = CONNECT;
129 result = m_SockStream.send_n(&send_conn_data,
sizeof send_conn_data);
137 result = m_SockStream.recv_n(&recv_conn_data,
sizeof recv_conn_data);
148 m_SockStream.enable(ACE_NONBLOCK);
194 return m_bLinked && in.
isOk() && out.
isOk();
213 return m_LocalAddress;
218 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)
A simple abstraction for a block of bytes.
Simple specification of the minimum functions needed from output streams.
#define yCError(component,...)
#define yCDebug(component,...)