C++ light wrapper for POSIX and Winsock sockets with implementation of TCP client/server using JSON messages,and HTTP, FTP clients
Get source:
git clone https://github.com/pedro-vicente/lib_netsockets.git
Build and test with:
make -f makefile make -f makefile test
On most Unix systems, the Jansson library is found on the default location with
cd build cmake ..
For a Windows Visual Studio build a statically build runtime library can be set with.
cmake .. -DSTATIC_CRT:BOOL=ON
Available at /msvc
lib_netsockets is C++ light wrapper for POSIX and Winsock sockets with implementation of TCP client/server using JSON messages,and HTTP, FTP clients.
tcp_server_t server(2000);
while (true)
{
socket_t socket = server.accept_client();
handle_client(socket);
socket.close();
}
server.close();
tcp_client_t client("127.0.0.1", 2000);
client.open();
client.write(buf, strlen(buf));
client.read_some(buf, sizeof(buf));
client.close();
http_t client("www.mysite.com", 80);
client.get("/my/path/to/file", true);
Get file list from FTP server and first file in list
ftp_t ftp("my.ftp.site", 21);
ftp.login("my user", "anonymous");
ftp.get_file_list();
ftp.get_file(ftp.m_file_nslt.at(0).c_str());
ftp.logout();