Modified socket behavior

multi_plaform
anulax1225 ago%!(EXTRA string=1 year)
parent 14d7f2fd6b
commit d215d4e7bd
  1. 14
      bakanet/src/bakanet/sock_layer/socket.h
  2. 0
      bakanet/src/bakanet/sock_layer/socket_options.h

@ -17,11 +17,21 @@ namespace Bk::Net {
virtual bool start(int cpt_conn) = 0;
virtual Connection ack() = 0;
virtual bool conn() = 0;
virtual int get_raw_socket() = 0;
virtual void emit(std::vector<char> packet) = 0;
virtual void emit(Connection socket, std::vector<char> packet) = 0;
virtual std::vector<char> obtain(int size) = 0;
virtual std::vector<char> obtain(Connection socket, int size) = 0;
static std::unique_ptr<Socket> Create(IpAddress ip, int port, IpProtocol proto);
template<typename T>
static bool set_option(Socket& socket, int level, int option_name, const T* option_value)
{
int status = setsockopt(socket.get_raw_socket(), level, option_name, (void*)option_value, sizeof(T));
log(status)
return status == 0 ? true : false;
}
static std::unique_ptr<Socket> create(IpAddress ip, int port, IpProtocol proto);
};
}
Loading…
Cancel
Save