27 ACE_INET_Addr ace_address(yarp_address.
getPort(), yarp_address.
getHost().c_str());
30 return connect(ace_address);
32 ACE_INET_Addr ace_server_addr(ace_address.get_port_number());
34 int result = m_Acceptor.open(ace_server_addr);
41 m_Acceptor.get_local_addr(ace_server_addr);
43 m_LocalAddress =
yarp::os::Contact(ace_server_addr.get_host_addr(), ace_server_addr.get_port_number());
44 m_RemoteAddress = m_LocalAddress;
66 ACE_INET_Addr local, remote;
67 m_SockStream.get_local_addr(local);
68 m_SockStream.get_remote_addr(remote);
69 m_LocalAddress =
yarp::os::Contact(local.get_host_addr(), local.get_port_number());
70 m_RemoteAddress =
yarp::os::Contact(remote.get_host_addr(), remote.get_port_number());
73 result = m_SockStream.recv_n(&recv_conn_data,
sizeof recv_conn_data);
80 if (!in.
open(m_RemoteAddress.
getPort(), &m_SockStream)) {
93 send_conn_data.
command = ACKNOWLEDGE;
94 if (m_SockStream.send_n(&send_conn_data,
sizeof send_conn_data) <= 0) {
102 m_SockStream.enable(ACE_NONBLOCK);
107 int ShmemHybridStream::connect(
const ACE_INET_Addr& ace_address)
113 ACE_SOCK_Connector connector;
121 ACE_INET_Addr
local, remote;
122 m_SockStream.get_local_addr(local);
123 m_SockStream.get_remote_addr(remote);
125 m_RemoteAddress =
yarp::os::Contact(remote.get_host_addr(), remote.get_port_number());
130 send_conn_data.
command = CONNECT;
132 result = m_SockStream.send_n(&send_conn_data,
sizeof send_conn_data);
140 result = m_SockStream.recv_n(&recv_conn_data,
sizeof recv_conn_data);
151 m_SockStream.enable(ACE_NONBLOCK);
197 return m_bLinked && in.
isOk() && out.
isOk();
216 return m_LocalAddress;
221 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,...)