34 mSock = ::socket( af, type, protocol );
49 ::shutdown(
mSock, SHUT_RD );
50 ::shutdown(
mSock, SHUT_WR );
56 return ::connect(
mSock, name, namelen );
59 unsigned int Socket::recv(
void* buf,
unsigned int len,
int flags )
61 return ::recv(
mSock, (
char*)buf, len, flags );
64 unsigned int Socket::recvfrom(
void* buf,
unsigned int len,
int flags, sockaddr* from,
unsigned int* fromlen )
66 return ::recvfrom(
mSock, buf, len, flags, from, fromlen );
69 unsigned int Socket::send(
const void* buf,
unsigned int len,
int flags )
71 return ::send(
mSock, (
const char*)buf, len, flags );
74 unsigned int Socket::sendto(
const void* buf,
unsigned int len,
int flags,
const sockaddr* to,
unsigned int tolen )
76 return ::sendto(
mSock, (
const char*)buf, len, flags, to, tolen );
81 return ::bind(
mSock, name, namelen );
86 return ::listen(
mSock, backlog );
99 int Socket::setopt(
int level,
int optname,
const void* optval,
unsigned int optlen )
101 return ::setsockopt(
mSock, level, optname, (
const char*)optval, optlen );
106 return ::fcntl(
mSock, cmd, arg );
Simple wrapper for sockets.
int listen(int backlog=SOMAXCONN)
unsigned int recvfrom(void *buf, unsigned int len, int flags, sockaddr *from, unsigned int *fromlen)
int bind(const sockaddr *name, unsigned int namelen)
Socket(int af, int type, int protocol)
unsigned int sendto(const void *buf, unsigned int len, int flags, const sockaddr *to, unsigned int tolen)
unsigned int recv(void *buf, unsigned int len, int flags)
int setopt(int level, int optname, const void *optval, unsigned int optlen)
Socket * accept(sockaddr *addr, unsigned int *addrlen)
unsigned int send(const void *buf, unsigned int len, int flags)
int fcntl(int cmd, long arg)
int connect(const sockaddr *name, unsigned int namelen)