sock_connect alternatives and similar libraries
Based on the "Networking" category.
Alternatively, view sock_connect alternatives based on common mentions on social networks and blogs.
-
libcurl
A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS. libcurl offers a myriad of powerful features -
POCO
The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems. -
C++ REST SDK
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services. -
RakNet
DISCONTINUED. RakNet is a cross platform, open source, C++ networking engine for game programmers. -
evpp
A modern C++ network library for developing high performance network services in TCP/UDP/HTTP protocols. -
Simple-Web-Server
DISCONTINUED. A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications. -
wdt
DISCONTINUED. Warp speed Data Transfer (WDT) is an embeddedable library (and command line tool) aiming to transfer data between 2 systems as fast as possible over multiple TCP paths. -
PcapPlusPlus
PcapPlusPlus is a multiplatform C++ library for capturing, parsing and crafting of network packets. It is designed to be efficient, powerful and easy to use. It provides C++ wrappers for the most popular packet processing engines such as libpcap, Npcap, WinPcap, DPDK, AF_XDP and PF_RING. -
cpp-netlib
The C++ Network Library Project -- cross-platform, standards compliant networking library. -
Restbed
Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications. -
Silicon
A high performance, middleware oriented C++14 http web framework please use matt-42/lithium instead -
Simple-WebSocket-Server
DISCONTINUED. A very simple, fast, multithreaded, platform independent WebSocket (WS) and WebSocket Secure (WSS) server and client library implemented using C++11, Boost.Asio and OpenSSL. Created to be an easy way to make WebSocket endpoints in C++. -
RESTinio
Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use -
nope.c
WAFer is a C language-based software platform for scalable server-side and networking applications. Think node.js for C programmers. -
IXWebSocket
websocket and http client and server library, with TLS support and very few dependencies -
mailio
mailio is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols. It is based on standard C++ 17 and Boost library. -
QuantumGate
QuantumGate is a peer-to-peer (P2P) communications protocol, library and API written in C++.
InfluxDB - Purpose built for real-time analytics at any scale.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of sock_connect or a related project?
README
Socket Connection wrapper shared library
Shared library that realize sockets connections and could transfer data-packages.
Navigation
Installation:
Compile from source
git clone https://github.com/DGolgovsky/sock_connect.git
clone git repositorycd sock_connect
change directory to cloned repo-dir./ci-build.sh -r
compile latest release version- also you can use
./ci-build.sh -h
for print help information for another variations of building cd build
jump to directory with compiled objectssudo make install
install library asroot
Package provides headers installs at /usr/include
and .so
library, puts to /usr/lib
Usage:
- Include header in your source files where do you need it.
#include <sock_connect.h>
- Compile with
-lsock_connect
Variations:
- Connection with
TCP
transmissionauto tcp = std::make_shared<Connector<TCP>>(IP, PORT);
- Connection with
UDP
transmissionauto udp = std::make_shared<Connector<UDP>>(INADDR_ANY, PORT);
- Connection with
UNIX-domain
sockets transmissionauto unix = std::make_shared<Connector<UNIX>>(sun_path);
- Connection with
USB
transmissionauto usb = std::make_shared<Connector<USB>>(dev_path, speed);
DEPRECATED
Transformconst char*
ip-addr192.168.1.42
touint32_t
uint32_t IP = ip_to_int(argv[1]);
Examples:
- Receiving
TCP
as client:
uint16_t msg = 0;
auto recv_sz = sizeof(uint16_t);
/* Create new socket connection */
auto tcp = std::make_shared<Connector<TCP>>(IP, PORT);
while (tcp->Status()) {
// While tcp establish connection to server
if (tcp->Connect()) {
// While data receiving do something with it
// if tcp connection lost tcp->Receive returns false
while (tcp->Receive(&msg, recv_sz)) {
// do_something with received data
// ...
}
// Trying reconnect if connection lost
tcp.reset(new Connector<TCP>(IP, PORT));
}
}
- Receiving
TCP
as multi-server:
template<class T>
void handler(T tcp, int client_id) {
tcp->assign_thread(client_id);
uint16_t msg = 0;
auto recv_sz = sizeof(uint16_t);
while ((tcp->Receive(&msg, recv_sz))) {
// do_something with received message
// ...
}
tcp->Shutdown(client_id);
}
/* Used if [this] - recv server */
void receiver()
{
/* Creating new connection */
auto tcp = std::make_shared<Connector<TCP>>(IP, PORT);
tcp->Bind(false); /* You can use it as TCP->Bind(); for bind && listen */
tcp->Listen(); /* You may don't need this part if you bind with (true) option */
int client_id = 0;
while ((client_id = tcp->Accept()) > 0) {
/* Accepting new connections and start receiving with the new thread */
std::thread thread(handler<decltype(tcp)>, tcp, client_id);
thread.detach();
}
}
- Sending
TCP
as client to server, broadcastingUDP
:
auto tcp = std::make_shared<Connector<TCP>>(INADDR_LOOPBACK, PORT); // 127.0.0.1
auto udp = std::make_shared<Connector<UDP>>(INADDR_ANY, PORT); // 0.0.0.0
uint16_t msg = 0;
auto msg_sz = sizeof(uint16_t);
// Infinite loop. This allow execute tcp_sender as daemon
while (true) {
if (tcp->Connect()) {
// If connection successful,
// send data while Status() returns true
while (tcp->Status()) {
msg = rand() % 50; // Generate random data
if (msg) {
// Trying to send message
// Continue if sending is failure,
// Also tcp->Status() will return false
if (!tcp->Send(&msg, msg_sz)) continue;
// Send udp package
udp->Send(&msg, msg_sz);
}
}
// Reconnecting if connection lost
tcp.reset(new Connector<TCP>(INADDR_LOOPBACK, PORT));
}
}
License:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[MIT License](../blob/master/LICENSE)
*Note that all licence references and agreements mentioned in the sock_connect README section above
are relevant to that project's source code only.