Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukasbanana/mercuriuslib
Simple Networking Library for C++11
https://github.com/lukasbanana/mercuriuslib
gaming-software library network network-programming socket
Last synced: 7 days ago
JSON representation
Simple Networking Library for C++11
- Host: GitHub
- URL: https://github.com/lukasbanana/mercuriuslib
- Owner: LukasBanana
- License: bsd-3-clause
- Created: 2017-04-22T20:40:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-24T14:12:56.000Z (over 6 years ago)
- Last Synced: 2024-12-28T12:02:27.273Z (about 1 month ago)
- Topics: gaming-software, library, network, network-programming, socket
- Language: C++
- Size: 51.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
MercuriusLib - Simple Networking Library for modern C++
=======================================================Overview
--------- **Version**: 1.00 Alpha
- **License**: [3-Clause BSD License](https://github.com/LukasBanana/MercuriusLib/blob/master/LICENSE.txt)Example
-------This is an example about the mesh generator:
```cpp
#include
#includeint main()
{
try
{
Mc::NetworkSystem net;
// Send HTTP GET request to server
auto addrGoogle = Mc::IPAddress::QueryAddressesFromHost("www.google.com");
if (!addrGoogle.empty())
{
auto& addr = addrGoogle.front();
addr->Port(80);
auto sock = Mc::TCPSocket::Make(Mc::AddressFamily::IPv4);
sock->Connect(*addr);
std::string getRequest = "GET /index.html HTTP/1.1\r\nHost: www.google.com\r\n\r\n";
sock->Send(getRequest.c_str(), static_cast(getRequest.size() + 1));
char getResponse[513];
while (true)
{
auto len = sock->Recv(getResponse, 512);
if (len > 0)
{
getResponse[len] = 0;
std::cout << getResponse;
}
else
break;
}
}
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
}
}
```