|
fipa_services
|
A UDTTransport provides a server that allows to establish udt connection to transfer fipa::acl::Letter. More...
#include <UDTTransport.hpp>
Public Member Functions | |
| UDTTransport () | |
| ~UDTTransport () | |
| void | start () |
| virtual void | update (bool readAllMessages=true) |
| Address | getAddress (const std::string &interfaceName="eth0") const |
| virtual OutgoingConnection::Ptr | establishOutgoingConnection (const Address &address) |
Public Member Functions inherited from fipa::services::transports::Transport | |
| virtual | ~Transport () |
| void | registerObserver (TransportObserver observer) |
| Type | getType () const |
| std::string | getName () const |
| void | send (const std::string &receiverName, const Address &address, const std::string &data) |
| std::set< Address > | getAddresses () const |
| OutgoingConnection::Ptr | getCachedOutgoingConnection (const std::string &receiverName, const Address &address) |
| void | cleanup (const std::string &receiver) |
| void | notify (const std::string &message) |
| void | setConfiguration (const Configuration &configuration) |
| const Configuration & | getConfiguration () const |
Additional Inherited Members | |
Public Types inherited from fipa::services::transports::Transport | |
| enum | Type { UNKNOWN = 0x00, UDT = 0x01, TCP = 0x02, ALL = 0xFF } |
| Builtin transport types that can be activated. More... | |
| typedef boost::shared_ptr< Transport > | Ptr |
Static Public Member Functions inherited from fipa::services::transports::Transport | |
| static Transport::Ptr | create (Type type) |
| static Type | getTypeFromTxt (const std::string &typeTxt) |
| static std::string | getLocalIPv4Address (const std::string &interfaceName="eth0") |
Static Public Attributes inherited from fipa::services::transports::Transport | |
| static std::map< Type, std::string > | TypeTxt |
Protected Member Functions inherited from fipa::services::transports::Transport | |
| Transport (Type type) | |
| Transport (const Configuration &configuration) | |
Protected Attributes inherited from fipa::services::transports::Transport | |
| Configuration | mConfiguration |
A UDTTransport provides a server that allows to establish udt connection to transfer fipa::acl::Letter.
The implementation is caching all incoming messages in an internal queue until they are handle by calling UDTTransport::nextLetter Very basic example for a receiver node:
#include <fipa_services/transports/udt/UDTTransport.hpp>
using namespace fipa::services;
udt::UDTTransport node;
// start node -- if no port is give it will be autoassigned and can be requested
// by node.getAddress() afterwards.
node.listen(2000);
while(true)
{
// accept new connections
node.accept();
// Handle message transfers/reading new data
node.update();
while(node.hasLetter())
{
fipa::acl::Letter letter = node.nextLetter();
// process letter
}
sleep(0.05);
}
A very basic example for a sender:
#include <fipa_services/transports/udt/UDTTransport.hpp>
// the address has to be known
udt::Adress address("127.0.0.1","2000");
// --------- Sender ------------
//
udt::OutgoingConnection connection(address);
fipa::acl::ACLMessage msg;
msg.setContent("test-content");
fipa::acl::Letter letter(msg, fipa::acl::representation::STRING_REP);
connection.sendLetter(letter);
| fipa::services::transports::udt::UDTTransport::UDTTransport | ( | ) |
| fipa::services::transports::udt::UDTTransport::~UDTTransport | ( | ) |
|
virtual |
Create a udt based outgoing connection
Reimplemented from fipa::services::transports::Transport.
|
virtual |
Get address of this node for a given interface
| interfaceName | name of the interface, default is eth0 |
Reimplemented from fipa::services::transports::Transport.
|
virtual |
Start transport functionality, e.g. listen socket etc.
Reimplemented from fipa::services::transports::Transport.
|
virtual |
Update and read all sockets
| readAllMessages | If set to true, update will return only when no further message can be read from any of the IncomingConnections. If set to false all connections will be checked only once for new messages |
Reimplemented from fipa::services::transports::Transport.
1.8.13