Example of open a ServerSocket and accepting a connection.
#include <sys/socket.h>
#include <memory>
#include <string>
#include <vector>
#include <thread>
int main(int argc, char** argv) {
server->bind();
server->listen();
const int timeout_ms = 50;
const SelectResult result = server->select(timeout_ms, true, false, true);
if(result.readyToRead) {
}
return 0;
}
std::shared_ptr< InetAddress > Ptr
static int create(SocketType socketType, const std::string &serviceName, const std::string &address, std::vector< InetAddress::Ptr > &created, unsigned int max=0)
static ServerSocket::Ptr create(std::shared_ptr< Address > theAddress)
std::shared_ptr< ServerSocket > Ptr
std::shared_ptr< Socket > Ptr
Namespace of the BsdSockets library.