iCub-main
Loading...
Searching...
No Matches
DSocket.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 RobotCub Consortium
3 * Author: Alessandro Scalzo alessandro.scalzo@iit.it
4 * CopyPolicy: Released under the terms of the GNU GPL v2.0.
5 *
6 */
7
8#ifndef __ETHUPDATER_DSOCKET_H__
9#define __ETHUPDATER_DSOCKET_H__
10
11#include <string>
12
13#include <ace/ACE.h>
14#include <ace/SOCK_Dgram_Bcast.h>
15#include "EoCommon.h"
16
18{
19public:
20 DSocket();
21 ~DSocket();
22
23 bool Create(ACE_UINT16 port,std::string& address);
24 bool Create(ACE_UINT16 port,ACE_UINT32 address);
25
26 bool Create(eOipv4addr_t ipv4, eOipv4port_t port);
27 void SendBroad(eOipv4port_t port, void* data, size_t len);
28 void SendTo(eOipv4addr_t ipv4, eOipv4port_t port, void* data, size_t len);
29 ssize_t ReceiveFrom(eOipv4addr_t &ipv4, eOipv4port_t &port, void* data, size_t len, int wait_msec);
30
31 void SendTo(void* data,size_t len,ACE_UINT16 port,std::string& address);
32 void SendTo(void* data,size_t len,ACE_UINT16 port,ACE_UINT32 address);
33
34 void SendBroad(void* data,size_t len,ACE_UINT16 port);
35
36 ssize_t ReceiveFrom(void* data,size_t len,std::string &address,ACE_UINT16 &port,int wait_msec);
37 ssize_t ReceiveFrom(void* data,size_t len,ACE_UINT32 &address,ACE_UINT16 &port,int wait_msec);
38
39 void Close();
40
41protected:
42 ACE_SOCK_Dgram_Bcast* mSocket;
43};
44
45#endif
@ data
void SendTo(eOipv4addr_t ipv4, eOipv4port_t port, void *data, size_t len)
Definition DSocket.cpp:58
ACE_SOCK_Dgram_Bcast * mSocket
Definition DSocket.h:42
bool Create(ACE_UINT16 port, std::string &address)
Definition DSocket.cpp:25
DSocket()
Definition DSocket.cpp:14
void SendBroad(eOipv4port_t port, void *data, size_t len)
Definition DSocket.cpp:70
ssize_t ReceiveFrom(eOipv4addr_t &ipv4, eOipv4port_t &port, void *data, size_t len, int wait_msec)
Definition DSocket.cpp:116
~DSocket()
Definition DSocket.cpp:19
void Close()
Definition DSocket.cpp:137