From 40ba7705b25bcc8a4cc4a1152863ee3cc7adba50 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 11 Nov 2024 20:09:56 +0300 Subject: [PATCH] update Socket.send, recv --- src/network/Network.cpp | 8 ++++---- src/network/Network.hpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/network/Network.cpp b/src/network/Network.cpp index 8766ff287..2ba72eafe 100644 --- a/src/network/Network.cpp +++ b/src/network/Network.cpp @@ -102,13 +102,13 @@ static inline int connectsocket( } static inline int recvsocket( - int descriptor, void* buf, size_t len, int flags + int descriptor, char* buf, size_t len, int flags ) noexcept { return recv(descriptor, buf, len, flags); } static inline int sendsocket( - int descriptor, const void* buf, size_t len, int flags + int descriptor, const char* buf, size_t len, int flags ) noexcept { return send(descriptor, buf, len, flags); } @@ -146,7 +146,7 @@ class SocketImpl : public Socket { freeaddrinfo(addr); } - int recv(void* buffer, size_t length, bool blocking) override { + int recv(char* buffer, size_t length, bool blocking) override { int len = recvsocket(descriptor, buffer, length, blocking ? MSG_WAITALL : MSG_DONTWAIT); if (len == 0) { int err = errno; @@ -162,7 +162,7 @@ class SocketImpl : public Socket { return len; } - int send(const void* buffer, size_t length) override { + int send(const char* buffer, size_t length) override { int len = sendsocket(descriptor, buffer, length, 0); if (len == -1) { int err = errno; diff --git a/src/network/Network.hpp b/src/network/Network.hpp index 099d8df78..4b89ae1f9 100644 --- a/src/network/Network.hpp +++ b/src/network/Network.hpp @@ -26,8 +26,8 @@ namespace network { class Socket { public: - virtual int recv(void* buffer, size_t length, bool blocking) = 0; - virtual int send(const void* buffer, size_t length) = 0; + virtual int recv(char* buffer, size_t length, bool blocking) = 0; + virtual int send(const char* buffer, size_t length) = 0; virtual void close() = 0; virtual bool isOpen() const = 0;