Skip to content

MicahSnell/SimpleSocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleSocket

An easy to use C++ socket library that supports UDP and TCP connections.

Build

$ cd SimpleSocket
$ make

Which will create lib/libSimpleSocket.a which you can then link in your project as -lSimpleSocket

Examples

To build the example applications:

$ cd SimpleSocket/example
$ make

Which will create socket_server and socket_client.

Debug

All binaries can be built with debug output enabled:

$ make debug

Minimal Usage

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

Documentation is created with doxygen:

$ cd SimpleSocket/doc
$ doxygen Doxyfile
$ <web browser> ./html/index.html

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published