The Library
Help/Info
Current Release
Sourceforge









Get dlib C++ Library at SourceForge.net. Fast, secure and Free Open Source software downloads


Last Modified:
Dec 28, 2012

Networking



This page documents tools built on top of the dlib sockets API. Therefore, all these tools are focused on providing some kind of higher level networking abstraction or service.


Objects
BSP
[top]

bridge



This object is a tool for bridging a pipe object between two network connected applications.

The bridge object is designed to link two pipes together as efficiently as possible. To demonstrate its speed, I ran two experiments where a bridge was used to connect a desktop PC to a laptop, both running Ubuntu 12.04 and connected via gigabit ethernet. The first experiment is to test its bulk transfer speed while the second experiment measures how many separate objects the bridge can transfer each second.

In the first experiment, 1-megapixel images, represented with array<rgb_pixel> objects, were sent. The transfer rate was 112 megabytes/second, saturating the gigabit ethernet link. The second experiment used a pipe<char> and bridge to send individual char variables over the network. In this experiment, I was able to send 3.2 million objects a second (i.e. the receiving end was getting a char back from pipe::dequeue() 3.2 million times each second).

For reference, these experiments were carried out on a desktop with a 2.67GHz Intel Core-i7 CPU and a laptop with a 2.20GHz Intel Core-i7 CPU.



#include <dlib/bridge.h>
Detailed Documentation
C++ Example Programs: bridge_ex.cpp

[top]

bsp_connect



This function spawns a BSP job consisting of a number of network hosts as well as the local host.

#include <dlib/bsp.h>
Detailed Documentation
C++ Example Programs: bsp_ex.cpp

[top]

bsp_context



This is a tool used to implement algorithms using the Bulk Synchronous Parallel (BSP) computing model. In particular, this object defines the API used for communication between BSP jobs.

#include <dlib/bsp.h>
Detailed Documentation
C++ Example Programs: bsp_ex.cpp

[top]

bsp_listen



This function listens for a TCP connection from the bsp_connect routine. Once this connection is established, a user supplied function will be executed and it will then be able to participate in a BSP computation as one of the processing nodes.

#include <dlib/bsp.h>
Detailed Documentation
C++ Example Programs: bsp_ex.cpp

[top]

bsp_listen_dynamic_port



This function listens for a TCP connection from the bsp_connect routine. Once this connection is established, a user supplied function will be executed and it will then be able to participate in a BSP computation as one of the processing nodes. This function has the additional ability to select the listening TCP port automatically from the set of available ports.

#include <dlib/bsp.h>
Detailed Documentation

[top]

iosockstream



This is an iostream object that reads/writes from a TCP network connection.

#include <dlib/iosockstream.h>
Detailed Documentation
C++ Example Programs: iosockstream_ex.cpp

[top]

linker



This object represents something that takes two connections and lets them talk to each other. ie. any incoming data from one connection is passed unaltered to the other and vice versa.

#include <dlib/linker.h>
Detailed Documentation

[top]

server



This object represents a server that listens on a port and spawns new threads to handle each new connection. It also manages the connections and threads for you.

#include <dlib/server.h>
Detailed Documentation
C++ Example Programs: sockets_ex.cpp

[top]

server_http



This is an extension of the server_iostream object which turns it into a simple HTTP server.

#include <dlib/server.h>
Detailed Documentation
C++ Example Programs: server_http_ex.cpp

[top]

server_iostream



This is an extension of the server object that redefines the on_connect() function so that instead of giving you a connection object you get an istream and ostream object.

#include <dlib/server.h>
Detailed Documentation
C++ Example Programs: server_iostream_ex.cpp

[top]

sockstreambuf



This object represents a stream buffer for connection objects. If you are considering using this object then you should also take a look at the iosockstream.

#include <dlib/sockstreambuf.h>
Detailed Documentation
C++ Example Programs: sockstreambuf_ex.cpp