|
|
|
@ -1,5 +1,4 @@ |
|
|
|
|
#include "linux_socket.h" |
|
|
|
|
#include <iostream> |
|
|
|
|
|
|
|
|
|
namespace Bk::Net { |
|
|
|
|
LinuxSocket::LinuxSocket(IpAddress ip, int port, IpProtocol proto) |
|
|
|
@ -86,30 +85,6 @@ namespace Bk::Net { |
|
|
|
|
buffer.resize(read_size); |
|
|
|
|
return buffer; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::vector<char> LinuxSocket::nobtain() |
|
|
|
|
{ |
|
|
|
|
std::vector<char> buffer(0); |
|
|
|
|
int len = 0; |
|
|
|
|
ioctl(socket_id, FIONREAD, &len); |
|
|
|
|
if (len > 0) { |
|
|
|
|
buffer.resize(len); |
|
|
|
|
len = read(socket_id, buffer.data(), buffer.size() - 1); |
|
|
|
|
} |
|
|
|
|
return buffer; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::vector<char> LinuxSocket::nobtain(Connection conn) |
|
|
|
|
{ |
|
|
|
|
std::vector<char> buffer(0); |
|
|
|
|
int len = 0; |
|
|
|
|
ioctl(socket_id, FIONREAD, &len); |
|
|
|
|
if (len > 0) { |
|
|
|
|
buffer.resize(len); |
|
|
|
|
len = read(conn, buffer.data(), buffer.size() - 1); |
|
|
|
|
} |
|
|
|
|
return buffer; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::unique_ptr<Socket> Socket::create(IpAddress ip, int port, IpProtocol proto) |
|
|
|
|
{ |
|
|
|
|