Fix README's examples to include headers as they are installed in a given system
This commit is contained in:
parent
c3bcc8f445
commit
ddfbbe5584
22
README.md
22
README.md
@ -14,7 +14,7 @@ Frnetlib is tested on both Linux and Windows and currently supports:
|
||||
# Connecting to a Socket:
|
||||
|
||||
```c++
|
||||
#include <TcpSocket.h>
|
||||
#include <frnetlib/TcpSocket.h>
|
||||
|
||||
fr::TcpSocket socket;
|
||||
if(socket.connect("127.0.0.1", "8081", std::chrono::seconds(10)) != fr::Socket::Status::Success)
|
||||
@ -27,8 +27,8 @@ Here, we create a new fr::TcpSocket and connect it to an address. Simple. fr::Tc
|
||||
# Listening and accepting connections:
|
||||
|
||||
```c++
|
||||
#include <TcpSocket.h>
|
||||
#include <TcpListener.h>
|
||||
#include <frnetlib/TcpSocket.h>
|
||||
#include <frnetlib/TcpListener.h>
|
||||
|
||||
fr::TcpListener listener;
|
||||
|
||||
@ -51,9 +51,9 @@ Here we create a new fr::TcpListener, which is used to listen for incoming conne
|
||||
# Using SSL
|
||||
|
||||
```c++
|
||||
#include <SSLSocket.h>
|
||||
#include <SSLContext.h>
|
||||
#include <SSLListener.h>
|
||||
#include <frnetlib/SSLSocket.h>
|
||||
#include <frnetlib/SSLContext.h>
|
||||
#include <frnetlib/SSLListener.h>
|
||||
|
||||
std::shared_ptr<fr::SSLContext> ssl_context(new fr::SSLContext()); //Creates a new 'SSL' context. This stores certificates and is shared between SSL enabled objects.
|
||||
ssl_conext->load_ca_certs_from_file(filepath); //This, or 'load_ca_certs_from_memory' should be called on the context, to load your SSL certificates.
|
||||
@ -71,7 +71,7 @@ SSLListener accepts a lot more arguments than its unencrypted counterpart, TcpLi
|
||||
# Sending packets:
|
||||
|
||||
```c++
|
||||
#include <Packet.h>
|
||||
#include <frnetlib/Packet.h>
|
||||
|
||||
fr::Packet packet;
|
||||
packet << "Hello there, I am" << (float)1.2 << "years old";
|
||||
@ -101,8 +101,8 @@ Effectively the reverse of sending packets. We call fr::TcpSocket::receive, pass
|
||||
# A simple HTTP server:
|
||||
|
||||
```c++
|
||||
#include <HttpRequest.h>
|
||||
#include <HttpResponse.h>
|
||||
#include <frnetlib/HttpRequest.h>
|
||||
#include <frnetlib/HttpResponse.h>
|
||||
|
||||
fr::TcpSocket client; //fr::TcpSocket for HTTP. fr::SSLSocket for HTTPS.
|
||||
fr::TcpListener listener; //Use an fr::SSLListener if HTTPS.
|
||||
@ -149,8 +149,8 @@ fr::HttpRequest objects are used for dealing with data being sent *to* the serve
|
||||
# A simple HTTP client:
|
||||
|
||||
```c++
|
||||
#include <HttpRequest.h>
|
||||
#include <HttpResponse.h>
|
||||
#include <frnetlib/HttpRequest.h>
|
||||
#include <frnetlib/HttpResponse.h>
|
||||
|
||||
//Connect to the website example.com on port 80, with a 10 second connection timeout
|
||||
fr::TcpSocket socket;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user