35 Commits

Author SHA1 Message Date
Cloaked9000
8a54e8994a Fixed read_raw buffer issues (properly this time).
Also added '<<' overload on Packet for char*
2016-12-21 17:57:39 +00:00
Cloaked9000
f74f1f1a94 Bug fixes. Better syntax.
SocketReactor actually calls callbacks.

receive_all no longer tries to access out of bound array indexes.

fr::Packet constructor can now take as many arguments as you like and they'll be added to it automatically.

Added bool fr::Packet<< operator overload.
2016-12-20 18:02:59 +00:00
Cloaked9000
70779fbe9c Added SocketReactor & fixes
Sockets will immediately return fr::Socket::Status::Disconnected if an attempt to send/receive data is made whilst the connection is closed.

Added SocketReactor, which is effectively a little wrapper around fr::SocketSelector, but can automatically call a callback for a socket when data is received on it.
2016-12-20 11:33:31 +00:00
Cloaked9000
7017b64a15 Moved fr::TcpSocket::shutdown to fr::Socket::shutdown 2016-12-20 10:12:13 +00:00
Cloaked9000
9db918c7c2 Added fr::TcpSocket::shutdown to shutdown a socket 2016-12-20 10:07:40 +00:00
Cloaked9000
2de9540819 Added windows support. Updated build system.
CMake build system builds as a library, not an executable now.

Windows is now supported and should work fine.
2016-12-19 12:10:39 +00:00
Fred Nicolson
9479029c87 Improved CMake build system. Updated readme.
The CMake build system now uses a relative path for modules, and supports a 'USE_SSL' option to optionally link in mbedtls and enable SSL support.

The readme now provides SSL examples.
2016-12-16 22:34:36 +00:00
Cloaked9000
8c94c337e9 SSL Contexts are now shared between sockets 2016-12-16 14:55:41 +00:00
Cloaked9000
509b37095f Added support for passing SSL cert info to listener 2016-12-15 17:59:39 +00:00
Cloaked9000
7d3e0fe5c8 Bug fixes & updated SocketSelector example. 2016-12-15 15:47:19 +00:00
Cloaked9000
2aeff56569 Merged branch master into master 2016-12-15 14:57:05 +00:00
Cloaked9000
69d183ed18 Code refactoring 2016-12-15 14:57:01 +00:00
Cloaked9000
34abd12414 Update README.md 2016-12-15 12:31:33 +00:00
Cloaked9000
14fccb84c9 More work on SSL support.
You can now accept SSL connections using SSLListeners, and then send/receive data through the associated SSLSocket.

HttpSocket's now support both HTTP and HTTPS, using templates:

fr::HttpSocket<fr::SSLSocket> https_socket; 
fr::HttpSocket<fr::TcpSocket> http_socket;
2016-12-15 12:29:23 +00:00
Cloaked9000
51291e2cc3 More experimental SSL code
Added SSLSocket, which can actually send/receive encrypted data.

Started adding SSLListener. It doesn't fully work yet.
2016-12-13 18:03:56 +00:00
Cloaked9000
7e9f007acd TLS Test Code 2016-12-12 18:03:27 +00:00
Cloaked9000
bbd6ee071b Added missing code to readme 2016-12-12 14:33:36 +00:00
Fred Nicolson
91921867fa Updated send/receive documentation. Updated readme. 2016-12-11 20:54:31 +00:00
Fred Nicolson
27a88febfa Added ability to toggle socket blocking mode 2016-12-11 20:45:13 +00:00
Cloaked9000
eec630ed24 Update README.md 2016-12-11 20:02:15 +00:00
Fred Nicolson
a5bd724b70 Merged branch master into master 2016-12-11 19:55:38 +00:00
Fred Nicolson
6d33e938b6 Added optional timeout to fr::SocketSelector::wait
'Wait' will return true if a socket has received data, false if the duration has expired.
2016-12-11 19:55:33 +00:00
Cloaked9000
159b15f5f9 Added examples and a description 2016-12-11 17:11:35 +00:00
Fred Nicolson
3b890972d1 Fixed 'host' HTTP header not being sent 2016-12-11 15:14:23 +00:00
Fred Nicolson
98897dec02 Cleaned up HTTP socket/request code. 2016-12-11 12:14:47 +00:00
Fred Nicolson
fdee42e300 Added ability to both send AND receive HTTP requests and responses. 2016-12-10 16:50:02 +00:00
Fred Nicolson
7aced77a00 Added support for sending and receiving HTTP requests.
Added 'HttpSocket', which inherits TcpSocket and adds a receive and send functions for WebRequest objects.

WebRequest objects can be used to parse, construct and extract HTTP requests. They can be sent through HttpSocket's.
2016-12-10 15:11:01 +00:00
Fred Nicolson
a3eb2ccd0a Added raw send and receive. Fixed TcpSocket close bug.
Can now send and receive raw data over TcpSockets for communicating with other protocols, such as HTTP.

Fixed TcpSocket::close only calling close() if the connection isn't open (gg wp)
2016-12-10 12:59:07 +00:00
Fred Nicolson
a9493fca2a Added documentation for SocketSelector. 2016-12-10 10:34:30 +00:00
Fred Nicolson
b581418f2e Added support for blocking on multiple sockets simultaneously 2016-12-09 23:52:16 +00:00
Fred Nicolson
9cbe2aa8e8 Fixed some dumb bugs. Think I may have been asleep for last push. 2016-12-09 22:04:37 +00:00
Cloaked9000
d36a98b9b2 Send/Receive works on TcpSocket now 2016-12-09 16:55:53 +00:00
Fred Nicolson
533412d3d0 Work on TcpListener and TcpSocket. 2016-12-08 23:01:01 +00:00
Fred Nicolson
4f9502df23 Pushed code across 2016-12-06 23:07:54 +00:00
Fred Nicolson
2502e2e7a0 Initial commit 2016-12-06 23:06:25 +00:00