3 This file is part of libmspnet
4 Copyright © 2008 Mikkosoft Productions, Mikko Rasa
5 Distributed under the LGPL
8 #ifndef MSP_NET_SOCKET_H_
9 #define MSP_NET_SOCKET_H_
11 #include <msp/io/base.h>
12 #include "constants.h"
19 class Socket: public IO::Base
30 Socket(SocketHandle, const SockAddr &);
31 Socket(Family, int, int);
36 IO::Handle get_event_handle();
38 bool is_connected() const { return connected; }
39 void bind(const SockAddr &);
40 virtual int connect(const SockAddr &) =0;
42 const SockAddr &get_local_address() const;
43 const SockAddr &get_peer_address() const;
45 void check_state(bool) const;
46 int get_option(int, int, void *, socklen_t *);
47 unsigned do_write(const char *, unsigned);
48 unsigned do_read(char *, unsigned);