haiku/headers/os/net/Socket.h
Rene Gollent c9dd7d0ddf libbnetapi: Extend socket classes.
B{Abstract,Datagram,Secure}Socket:
- Add functionality to listen for and accept new connections, thus allowing
  one to use the socket classes for server functionality as well.

BSecureSocket:
- Adjust to take into account differences between how SSL needs to be called
  when accepting an incoming connection vs initiating an outbound one.
  The handshake on the accepted connection stills fails for unknown reasons
  at the moment though.

Note that these changes break the ABI, and thus any packages making use of
them directly will need a rebuild.
2016-04-28 22:30:40 -04:00

41 lines
938 B
C++

/*
* Copyright 2011-2016, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _SOCKET_H
#define _SOCKET_H
#include <AbstractSocket.h>
class BSocket : public BAbstractSocket {
public:
BSocket();
BSocket(const BNetworkAddress& peer,
bigtime_t timeout = B_INFINITE_TIMEOUT);
BSocket(const BSocket& other);
virtual ~BSocket();
virtual status_t Bind(const BNetworkAddress& peer,
bool reuseAddr = true);
virtual status_t Accept(BAbstractSocket*& _socket);
virtual status_t Connect(const BNetworkAddress& peer,
bigtime_t timeout = B_INFINITE_TIMEOUT);
// BDataIO implementation
virtual ssize_t Read(void* buffer, size_t size);
virtual ssize_t Write(const void* buffer, size_t size);
protected:
void _SetTo(int fd, const BNetworkAddress& local,
const BNetworkAddress& peer);
};
#endif // _SOCKET_H