11 Commits

Author SHA1 Message Date
Fred Nicolson
84382cad0b Made some changes recommended by Clang-Tidy. 2017-07-20 15:02:43 +01:00
Fred Nicolson
e748fde121 API changes, and lots of fixes.
fr::HttpSocket has been removed.

fr::Sendable has been added. Classes can inherit this if they want to be sendable through sockets. Both fr::Http (which is inherited by fr::HttpRequest and fr::HttpResponse), and fr::Packet inherit this, to allow them to be sent through fr::Socket::send()/fr::Socket::receive().

Fixed broken fr::SocketSelector and fr::SocketReactor, as they no longer accepted fr::Listener's due to fr::Listener no longer inheriting fr::Socket.
2017-07-18 17:34:49 +01:00
Fred Nicolson
ae61464aee Removed is_connected flag in fr::Socket
The socket descriptor is now checked, to see if it's greater than 0, instead. This means that the flag doesn't have to be manually updated.
2017-05-25 16:21:39 +01:00
Fred Nicolson
fad7d0b81f Packet and socket optimisations
Sending/receiving data on a socket is roughly 5.5x faster, after removing data copies and buffer re-allocations.
2017-01-25 22:57:11 +00:00
Cloaked9000
64f35e2a92 Increased receive chunk size to 4096 bytes 2017-01-13 15:30:11 +00:00
Fred Nicolson
2a5d960e56 Added fr::Socket::has_data to check if recv buffer is empty
If using a SocketSelector, you should keep accepting data from the socket until has_data returns false, indicating that you've read everything.
2016-12-27 21:58:39 +00:00
Fred Nicolson
8638b70fb8 Thread safety for send/receive on both Tcp & SSL sockets
Send/Recv often needs to be called multiple times to transfer all of the data. send_raw/receive_raw are now mutex protected and so both send & receive can be called simultaneously.
2016-12-23 18:23:25 +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
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