#ifndef SOCKET_H
#define SOCEKT_H
#include "common.h"
class Poll {
private:
int count;
int allocatedCount;
void *data;
public:
Poll();
~Poll();
void add(int sockId, bool wantRead, bool wantWrite);
void clear();
bool wait(Time time);
};
class Socket {
private:
Socket();
public:
static int tcpConnect(const Address &address);
static int tcpListen(const Address &address);
static int tcpAccept(int soskId);
static int tcpSendAsync(int soskId, const void *data, int size);
static int tcpRecvAsync(int soskId, void *data, int size);
static int udpBind(int soskId, const Address &address);
static int udpSend(int soskId, const Address &address, const void *data, int size);
static int udpRecvAsync(Address *address, void *data, int size);
static void close(int soskId);
};
#endif