![]() |
YDLIDAR SDK
V1.3.6
|
#include <ActiveSocket.h>
Public Member Functions | |
CActiveSocket (CSocketType type=SocketTypeTcp) | |
virtual bool | Open (const char *pAddr, uint16_t nPort) |
![]() | |
CSimpleSocket (CSocketType type=SocketTypeTcp) | |
CSimpleSocket (CSimpleSocket &socket) | |
virtual bool | Initialize (void) |
virtual bool | Close (void) |
virtual bool | Shutdown (CShutdownMode nShutdown) |
virtual bool | Select (void) |
virtual bool | Select (int32_t nTimeoutSec, int32_t nTimeoutUSec) |
virtual int | WaitForData (size_t data_count, uint32_t timeout, size_t *returned_size) |
virtual bool | IsSocketValid (void) |
void | TranslateSocketError (void) |
const char * | DescribeError () |
virtual int32_t | Receive (int32_t nMaxBytes=1, uint8_t *pBuffer=0) |
virtual int32_t | Send (const uint8_t *pBuf, size_t bytesToSend) |
virtual int32_t | Send (const struct iovec *sendVector, int32_t nNumItems) |
virtual int32_t | SendFile (int32_t nOutFd, int32_t nInFd, off_t *pOffset, int32_t nCount) |
bool | IsNonblocking (void) |
bool | SetBlocking (void) |
bool | SetNonblocking (void) |
uint8_t * | GetData (void) |
int32_t | GetBytesReceived (void) |
int32_t | GetBytesSent (void) |
bool | SetOptionLinger (bool bEnable, uint16_t nTime) |
bool | SetOptionReuseAddr () |
int32_t | GetConnectTimeoutSec (void) |
int32_t | GetConnectTimeoutUSec (void) |
void | SetConnectTimeout (int32_t nConnectTimeoutSec, int32_t nConnectTimeoutUsec=0) |
int32_t | GetReceiveTimeoutSec (void) |
int32_t | GetReceiveTimeoutUSec (void) |
bool | SetReceiveTimeout (int32_t nRecvTimeoutSec, int32_t nRecvTimeoutUsec=0) |
bool | SetMulticast (bool bEnable, uint8_t multicastTTL=1) |
bool | GetMulticast () |
bool | BindInterface (const char *pInterface) |
int32_t | GetSendTimeoutSec (void) |
int32_t | GetSendTimeoutUSec (void) |
bool | SetSendTimeout (int32_t nSendTimeoutSec, int32_t nSendTimeoutUsec=0) |
CSocketError | GetSocketError (void) |
uint32_t | GetTotalTimeMs () |
uint32_t | GetTotalTimeUsec () |
int | GetSocketDscp (void) |
bool | SetSocketDscp (int nDscp) |
SOCKET | GetSocketDescriptor () |
CSocketType | GetSocketType () |
void | SetSocketType (const CSocketType &type) |
set socket descriptor | |
const char * | GetClientAddr () |
uint16_t | GetClientPort () |
const char * | GetServerAddr () |
uint16_t | GetServerPort () |
uint32_t | GetReceiveWindowSize () |
uint32_t | GetSendWindowSize () |
uint32_t | SetReceiveWindowSize (uint32_t nWindowSize) |
uint32_t | SetSendWindowSize (uint32_t nWindowSize) |
bool | DisableNagleAlgoritm () |
bool | EnableNagleAlgoritm () |
virtual bool | bindport (const char *, uint32_t) |
virtual bool | open () |
virtual bool | isOpen () |
virtual void | closePort () |
virtual void | flush () |
virtual int | waitfordata (size_t data_count, uint32_t timeout=-1, size_t *returned_size=NULL) |
virtual size_t | writeData (const uint8_t *data, size_t size) |
virtual size_t | readData (uint8_t *data, size_t size) |
![]() | |
virtual bool | setDTR (bool level=true) |
virtual int | getByteTime () |
virtual void | ReleasePort () |
Friends | |
class | CPassiveSocket |
Additional Inherited Members | |
![]() | |
enum | CShutdownMode { Receives = SHUT_RD, Sends = SHUT_WR, Both = SHUT_RDWR } |
Defines the three possible states for shuting down a socket. More... | |
enum | CSocketType { SocketTypeInvalid = 0, SocketTypeTcp, SocketTypeUdp, SocketTypeTcp6, SocketTypeUdp6, SocketTypeRaw } |
Defines the socket types defined by CSimpleSocket class. More... | |
enum | CSocketError { SocketError = -1, SocketSuccess = 0, SocketInvalidSocket, SocketInvalidAddress, SocketInvalidPort, SocketConnectionRefused, SocketTimedout, SocketEwouldblock, SocketNotconnected, SocketEinprogress, SocketInterrupted, SocketConnectionAborted, SocketProtocolError, SocketFirewallError, SocketInvalidSocketBuffer, SocketConnectionReset, SocketAddressInUse, SocketInvalidPointer, SocketEunknown } |
Defines all error codes handled by the CSimpleSocket class. More... | |
![]() | |
static const char * | DescribeError (CSocketError err) |
![]() | |
void | SetSocketError (CSimpleSocket::CSocketError error) |
void | SetSocketHandle (SOCKET socket) |
bool | Flush () |
![]() | |
SOCKET | m_socket |
CSocketError | m_socketErrno |
socket handle | |
uint8_t * | m_pBuffer |
number of last error | |
int32_t | m_nBufferSize |
internal send/receive buffer | |
int32_t | m_nSocketDomain |
size of internal send/receive buffer | |
CSocketType | m_nSocketType |
socket type PF_INET, PF_INET6 | |
int32_t | m_nBytesReceived |
socket type - UDP, TCP or RAW | |
int32_t | m_nBytesSent |
number of bytes received | |
uint32_t | m_nFlags |
number of bytes sent | |
bool | m_bIsBlocking |
socket flags | |
bool | m_bIsMulticast |
is socket blocking | |
struct timeval | m_stConnectTimeout |
is the UDP socket multicast; | |
struct timeval | m_stRecvTimeout |
connection timeout | |
struct timeval | m_stSendTimeout |
receive timeout | |
struct sockaddr_in | m_stServerSockaddr |
send timeout | |
struct sockaddr_in | m_stClientSockaddr |
server address | |
struct sockaddr_in | m_stMulticastGroup |
client address | |
struct linger | m_stLinger |
multicast group to bind to | |
CStatTimer | m_timer |
linger flag | |
fd_set | m_writeFds |
internal statistics. | |
fd_set | m_readFds |
write file descriptor set | |
fd_set | m_errorFds |
read file descriptor set | |
std::string | m_addr |
error file descriptor set | |
uint32_t | m_port |
bool | m_open |
Provides a platform independent class to create an active socket. An active socket is used to create a socket which connects to a server. This type of object would be used when an application needs to send/receive data from a server.
|
virtual |
Established a connection to the address specified by pAddr. Connection-based protocol sockets (CSocket::SocketTypeTcp) may successfully call open() only once, however; connectionless protocol sockets (CSocket::SocketTypeUdp) may use Open() multiple times to change their association.
pAddr | specifies the destination address to connect. |
nPort | specifies the destination port. |
Reimplemented from ydlidar::CSimpleSocket.