fixes
This commit is contained in:
parent
9bdf133d0f
commit
c49f947a9b
6 changed files with 123 additions and 21 deletions
|
|
@ -17,7 +17,20 @@ You should have received a copy of the GNU Lesser General Public
|
|||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
module;
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netdb.h>
|
||||
#include <strings.h>
|
||||
#include <cerrno>
|
||||
export module Crafter.Network:ClientTCP;
|
||||
import std;
|
||||
|
||||
|
|
@ -36,6 +49,9 @@ namespace Crafter {
|
|||
ClientTCP(const char* host, std::uint16_t port);
|
||||
ClientTCP(std::string host, std::uint16_t port);
|
||||
~ClientTCP();
|
||||
ClientTCP(const ClientTCP&) = delete;
|
||||
ClientTCP(ClientTCP&& other) noexcept;
|
||||
void Connect();
|
||||
void Stop();
|
||||
void Send(const void* buffer, std::uint32_t size) const;
|
||||
std::vector<char> RecieveSync() const;
|
||||
|
|
@ -48,5 +64,8 @@ namespace Crafter {
|
|||
void RecieveAsync(std::uint32_t bufferSize, std::function<void(std::vector<char>)> recieveCallback) const;
|
||||
void RecieveUntilFullAsync(std::uint32_t bufferSize, std::function<void(std::vector<char>)> recieveCallback) const;
|
||||
void RecieveAsync(std::uint32_t bufferSize, std::function<void(int)> recieveCallback, char* buffer) const;
|
||||
private:
|
||||
hostent* host;
|
||||
sockaddr_in serv_addr;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue