1 #ifndef INCLUDE_COMMUNICATION_SOCKET_H_
2 #define INCLUDE_COMMUNICATION_SOCKET_H_
5 #include "communication/msg.h"
8 const string kInprocRouterEndpoint=
"inproc://router";
63 std::map<zsock_t*, Socket*> zsock2Socket_;
86 virtual int Connect(
string endpoint);
122 virtual int Bind(
string endpoint);
134 std::map<int, zframe_t*> id2addr_;
135 std::map<int, std::vector<zmsg_t*>> bufmsg_;
136 int nBufmsg_, bufsize_;
140 vector<shared_ptr<SafeQueue>> MPIQueues;
144 #endif // INCLUDE_COMMUNICATION_SOCKET_H_
virtual void * InternalID() const =0
virtual int Bind(string endpoint)
Setup the connection with dealers.
Router(int bufsize=100)
Constructor.
virtual void * InternalID() const
Definition: socket.h:89
virtual void Add(Socket *socket)=0
Add a socket for polling; Multiple sockets can be polled together by adding them into the same poller...
virtual int Send(Msg **msg)
If the destination socket has not connected yet, buffer this the message.
virtual Msg * Receive()
Receive a message from any connected socket.
virtual int Send(Msg **msg)
Send a message to connected socket(s), non-blocking.
virtual Msg * Receive()
Receive a message from any connected socket.
virtual Socket * Wait(int timeout)=0
Poll for all sockets added into this poller.
virtual void Add(Socket *socket)
Add a socket for polling; Multiple sockets can be polled together by adding them into the same poller...
virtual int Connect(string endpoint)
Setup the connection with the router.
virtual void * InternalID() const
Definition: socket.h:128
virtual Msg * Receive()=0
Receive a message from any connected socket.
virtual Socket * Wait(int duration)
Poll for all sockets added into this poller.
virtual int Send(Msg **msg)=0
Send a message to connected socket(s), non-blocking.