xref: /haiku/headers/os/net/Socket.h (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
1 /*
2  * Copyright 2011, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _SOCKET_H
6 #define _SOCKET_H
7 
8 
9 #include <AbstractSocket.h>
10 
11 
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();
19 
20 	virtual	status_t			Bind(const BNetworkAddress& peer);
21 	virtual	status_t			Connect(const BNetworkAddress& peer,
22 									bigtime_t timeout = B_INFINITE_TIMEOUT);
23 
24 	// BDataIO implementation
25 
26 	virtual ssize_t				Read(void* buffer, size_t size);
27 	virtual ssize_t				Write(const void* buffer, size_t size);
28 
29 private:
30 	friend class BServerSocket;
31 
32 			void				_SetTo(int fd, const BNetworkAddress& local,
33 									const BNetworkAddress& peer);
34 };
35 
36 
37 #endif	// _SOCKET_H
38