]> git.tdb.fi Git - libs/net.git/blob - source/net/serversocket.h
Add a dynamic receiver class for more flexible packet handling
[libs/net.git] / source / net / serversocket.h
1 #ifndef MSP_NET_SERVERSOCKET_H_
2 #define MSP_NET_SERVERSOCKET_H_
3
4 #include "mspnet_api.h"
5 #include "socket.h"
6
7 namespace Msp {
8 namespace Net {
9
10 class ClientSocket;
11
12 /**
13 ServerSockets are used to receive incoming connections.  They cannot be used
14 for sending and receiving data.
15 */
16 class MSPNET_API ServerSocket: public Socket
17 {
18 protected:
19         ServerSocket(Family, int, int);
20
21 public:
22         virtual void listen(const SockAddr &, unsigned = 4) = 0;
23
24         virtual ClientSocket *accept() = 0;
25 protected:
26         std::size_t do_write(const char *, std::size_t) override;
27         std::size_t do_read(char *, std::size_t) override;
28 };
29
30 } // namespace Net
31 } // namespace Msp
32
33 #endif