An easy to use C++ socket library that supports UDP and TCP connections.
$ cd SimpleSocket
$ make
Which will create lib/libSimpleSocket.a
which you can then link in your project as -lSimpleSocket
To build the example applications:
$ cd SimpleSocket/example
$ make
Which will create socket_server
and socket_client
.
All binaries can be built with debug output enabled:
$ make debug
A client socket that sends to localhost on port 54321 using TCP.
simple_socket::Socket socket ("localhost", 54321, simple_socket::Socket::TCP);
int myInt = 42;
socket.Send (&myInt, sizeof (myInt));
A host socket that accepts TCP connections on port 54321.
simple_socket::Socket socket (54321, simple_socket::Socket::TCP);
int myInt = 0;
socket.Recv (&myInt, sizeof (myInt));
std::cout << "Received: " << myInt << std::endl; // "Received: 42"
Documentation is created with doxygen
:
$ cd SimpleSocket/doc
$ doxygen Doxyfile
$ <web browser> ./html/index.html