39 lines
589 B
C++
39 lines
589 B
C++
#ifndef RETRONFS95_SOCKET_HPP
|
|
#define RETRONFS95_SOCKET_HPP
|
|
|
|
#include "compat.hpp"
|
|
|
|
namespace retronfs {
|
|
|
|
class SocketSystem {
|
|
public:
|
|
SocketSystem();
|
|
~SocketSystem();
|
|
};
|
|
|
|
class TcpSocket {
|
|
public:
|
|
TcpSocket();
|
|
~TcpSocket();
|
|
|
|
void connect_to(const std::string& host, unsigned short port, unsigned timeout_ms);
|
|
void send_all(const Bytes& data);
|
|
Bytes recv_exact(unsigned count);
|
|
void close();
|
|
|
|
private:
|
|
TcpSocket(const TcpSocket&);
|
|
TcpSocket& operator=(const TcpSocket&);
|
|
|
|
#ifdef _WIN32
|
|
unsigned int fd_;
|
|
#else
|
|
int fd_;
|
|
#endif
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|
|
|