Fix FreeBSD build.
[haiku.git] / headers / os / net / Socket.h
blob94070a37867c7c279bc03ebb35ad41f00f4ebd0a
1 /*
2 * Copyright 2011-2016, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _SOCKET_H
6 #define _SOCKET_H
9 #include <AbstractSocket.h>
12 class BSocket : public BAbstractSocket {
13 public:
14 BSocket();
15 BSocket(const BNetworkAddress& peer,
16 bigtime_t timeout = B_INFINITE_TIMEOUT);
17 BSocket(const BSocket& other);
18 virtual ~BSocket();
20 virtual status_t Bind(const BNetworkAddress& peer,
21 bool reuseAddr = true);
23 virtual status_t Accept(BAbstractSocket*& _socket);
25 virtual status_t Connect(const BNetworkAddress& peer,
26 bigtime_t timeout = B_INFINITE_TIMEOUT);
28 // BDataIO implementation
30 virtual ssize_t Read(void* buffer, size_t size);
31 virtual ssize_t Write(const void* buffer, size_t size);
33 protected:
35 void _SetTo(int fd, const BNetworkAddress& local,
36 const BNetworkAddress& peer);
40 #endif // _SOCKET_H