YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
shmem::Socket Class Reference

A minimal IPv4 TCP socket. More...

#include <shmem_carrier/ShmemPlatform.h>

Public Member Functions

 Socket ()=default
 
 ~Socket ()
 
 Socket (const Socket &)=delete
 
Socket & operator= (const Socket &)=delete
 
bool listen (int port)
 Listen on all the interfaces (port 0 means any free port)
 
bool accept (Socket &stream)
 Accept a connection on a listening socket.
 
bool connect (const std::string &host, int port)
 
bool sendAll (const void *data, size_t len)
 Send exactly len bytes (blocking socket)
 
bool recvAll (void *data, size_t len)
 Receive exactly len bytes (blocking socket)
 
bool isPeerClosed ()
 Check, on a non-blocking socket, whether the connection was closed or reset by the peer (e.g.
 
bool setNonBlocking ()
 
bool getLocalAddress (std::string &host, int &port) const
 
bool getRemoteAddress (std::string &host, int &port) const
 
void close ()
 

Detailed Description

A minimal IPv4 TCP socket.

Definition at line 93 of file ShmemPlatform.h.

Constructor & Destructor Documentation

◆ Socket() [1/2]

shmem::Socket::Socket ( )
default

◆ ~Socket()

shmem::Socket::~Socket ( )

Definition at line 521 of file ShmemPlatform.cpp.

◆ Socket() [2/2]

shmem::Socket::Socket ( const Socket &  )
delete

Member Function Documentation

◆ accept()

bool shmem::Socket::accept ( Socket &  stream)

Accept a connection on a listening socket.

Definition at line 559 of file ShmemPlatform.cpp.

◆ close()

void shmem::Socket::close ( )

Definition at line 753 of file ShmemPlatform.cpp.

◆ connect()

bool shmem::Socket::connect ( const std::string &  host,
int  port 
)

Definition at line 580 of file ShmemPlatform.cpp.

◆ getLocalAddress()

bool shmem::Socket::getLocalAddress ( std::string &  host,
int &  port 
) const

Definition at line 727 of file ShmemPlatform.cpp.

◆ getRemoteAddress()

bool shmem::Socket::getRemoteAddress ( std::string &  host,
int &  port 
) const

Definition at line 740 of file ShmemPlatform.cpp.

◆ isPeerClosed()

bool shmem::Socket::isPeerClosed ( )

Check, on a non-blocking socket, whether the connection was closed or reset by the peer (e.g.

because the peer process died)

Definition at line 684 of file ShmemPlatform.cpp.

◆ listen()

bool shmem::Socket::listen ( int  port)

Listen on all the interfaces (port 0 means any free port)

Definition at line 526 of file ShmemPlatform.cpp.

◆ operator=()

Socket & shmem::Socket::operator= ( const Socket &  )
delete

◆ recvAll()

bool shmem::Socket::recvAll ( void *  data,
size_t  len 
)

Receive exactly len bytes (blocking socket)

Definition at line 660 of file ShmemPlatform.cpp.

◆ sendAll()

bool shmem::Socket::sendAll ( const void *  data,
size_t  len 
)

Send exactly len bytes (blocking socket)

Definition at line 630 of file ShmemPlatform.cpp.

◆ setNonBlocking()

bool shmem::Socket::setNonBlocking ( )

Definition at line 710 of file ShmemPlatform.cpp.


The documentation for this class was generated from the following files: