A basic blocking socket.
More...
#include <Socket.h>
|
int | GetError () const |
|
void | ClearError () |
| Clear the error from the last failed operation on this socket. More...
|
|
SOCKET | Peek () const |
|
bool | IsCreated () const |
| Returns true if the socket has been created. More...
|
|
bool | IsConnected () const |
| Returns true if the socket has been successfuly connected. More...
|
|
void | Select (bool read, bool write, bool except, const int timeout_in_seconds, bool &timed_out) |
| The select function determines the status of the socket, waiting if necessary, to perform synchronous I/O. More...
|
|
void | SetHardClose (unsigned short timeout=0) |
| Turn on the linger option. Closing a socket does not wait for for the session to breakdown, unless you have requested it by setting the linger socket option. More...
|
|
void | SetGracefulClose () |
| Turn off the linger option. Closing a socket does not wait for for the session to breakdown, unless you have requested it by setting the linger socket option. More...
|
|
void | SetSocketReuse () |
| Turn on the resue address option. Allows the socket to be bound to an address that is already in use. More...
|
|
void | Socket::Connect (const std::wstring &ip_addr, unsigned port, int type=SOCK_STREAM, int protocol=IPPROTO_IP) |
| Initialize the socket and connect to a destination. Defaults to TCP, specify SOCK_DGRAM for UDP. See WSASocket reference for more information. More...
|
|
void | Connect (const std::string &ip_addr, unsigned port, int type=SOCK_STREAM, int protocol=IPPROTO_IP) |
| Initialize the socket and connect to a destination. Defaults to TCP, specify SOCK_DGRAM for UDP. See WSASocket reference for more information. More...
|
|
void | Connect (const struct sockaddr *name, int namelen) |
|
void | Disconnect () |
| Shutdown, receive out-of-band data and close the socket (disconnect from a remote host). More...
|
|
void | Bind (const std::string &ip_addr, unsigned port, int type=SOCK_STREAM, int protocol=IPPROTO_IP) |
| Bind the socket to an address. More...
|
|
| Socket () |
| constructor More...
|
|
virtual | ~Socket () |
|
|
virtual void | InternalSetSockOpt (int level, int optname, const char *optval, int optlen) |
| Set a socket option. More...
|
|
virtual void | InternalIoCtlSocket (long cmd, u_long *argp) |
| Control socket IO. More...
|
|
virtual void | InternalCreate (int af=AF_INET, int type=SOCK_STREAM, int protocol=IPPROTO_IP, LPWSAPROTOCOL_INFO lpProtocolInfo=NULL, GROUP g=NULL, DWORD dwFlags=0) |
| Create a socket. See WSASocket or ::socket for more information. More...
|
|
virtual void | InternalConnect (const struct sockaddr *name, int namelen, LPWSABUF lpCallerData=NULL, LPWSABUF lpCalleeData=NULL, LPQOS lpSQOS=NULL, LPQOS lpGQOS=NULL) |
| Connect a socket. See WSAConnect or ::connect for more information. More...
|
|
virtual void | InternalShutdown (int how) |
| Shutdown a socket. More...
|
|
virtual void | InternalClose () |
| Close a socket. More...
|
|
A basic blocking socket.
A basic blocking socket that is bound to a specific transport-service provider.
void Socket::Bind |
( |
const std::string & |
ip_addr, |
|
|
unsigned |
port, |
|
|
int |
type = SOCK_STREAM , |
|
|
int |
protocol = IPPROTO_IP |
|
) |
| |
Bind the socket to an address.
void AppSecInc::TcpIp::Sockets::Socket::ClearError |
( |
| ) |
|
|
inline |
Clear the error from the last failed operation on this socket.
void Socket::Connect |
( |
const std::string & |
ip_addr, |
|
|
unsigned |
port, |
|
|
int |
type = SOCK_STREAM , |
|
|
int |
protocol = IPPROTO_IP |
|
) |
| |
Initialize the socket and connect to a destination. Defaults to TCP, specify SOCK_DGRAM for UDP. See WSASocket reference for more information.
void Socket::Connect |
( |
const struct sockaddr * |
name, |
|
|
int |
namelen |
|
) |
| |
- Deprecated:
- Initialize the socket and connect to a destination. Provided for backwards compatibility only.
void Socket::Disconnect |
( |
| ) |
|
Shutdown, receive out-of-band data and close the socket (disconnect from a remote host).
int AppSecInc::TcpIp::Sockets::Socket::GetError |
( |
| ) |
const |
|
inline |
Returns the error from any last failed operation on this socket, equivalent to calling WSAGetLastError().
- Note
- The error is not cleared on a successful operation.
void Socket::InternalClose |
( |
| ) |
|
|
protectedvirtual |
void Socket::InternalConnect |
( |
const struct sockaddr * |
name, |
|
|
int |
namelen, |
|
|
LPWSABUF |
lpCallerData = NULL , |
|
|
LPWSABUF |
lpCalleeData = NULL , |
|
|
LPQOS |
lpSQOS = NULL , |
|
|
LPQOS |
lpGQOS = NULL |
|
) |
| |
|
protectedvirtual |
Connect a socket. See WSAConnect or ::connect for more information.
void Socket::InternalCreate |
( |
int |
af = AF_INET , |
|
|
int |
type = SOCK_STREAM , |
|
|
int |
protocol = IPPROTO_IP , |
|
|
LPWSAPROTOCOL_INFO |
lpProtocolInfo = NULL , |
|
|
GROUP |
g = NULL , |
|
|
DWORD |
dwFlags = 0 |
|
) |
| |
|
protectedvirtual |
Create a socket. See WSASocket or ::socket for more information.
void Socket::InternalIoCtlSocket |
( |
long |
cmd, |
|
|
u_long * |
argp |
|
) |
| |
|
protectedvirtual |
void Socket::InternalSetSockOpt |
( |
int |
level, |
|
|
int |
optname, |
|
|
const char * |
optval, |
|
|
int |
optlen |
|
) |
| |
|
protectedvirtual |
void Socket::InternalShutdown |
( |
int |
how | ) |
|
|
protectedvirtual |
bool AppSecInc::TcpIp::Sockets::Socket::IsConnected |
( |
| ) |
const |
|
inline |
Returns true if the socket has been successfuly connected.
bool AppSecInc::TcpIp::Sockets::Socket::IsCreated |
( |
| ) |
const |
|
inline |
Returns true if the socket has been created.
SOCKET AppSecInc::TcpIp::Sockets::Socket::Peek |
( |
| ) |
const |
|
inline |
- Deprecated:
- Returns the socket handle. Provided for backwards compatibility only.
void AppSecInc::TcpIp::Sockets::Socket::Select |
( |
bool |
read, |
|
|
bool |
write, |
|
|
bool |
except, |
|
|
const int |
timeout_in_seconds, |
|
|
bool & |
timed_out |
|
) |
| |
The select function determines the status of the socket, waiting if necessary, to perform synchronous I/O.
void Socket::SetGracefulClose |
( |
| ) |
|
Turn off the linger option. Closing a socket does not wait for for the session to breakdown, unless you have requested it by setting the linger socket option.
void Socket::SetHardClose |
( |
unsigned short |
timeout = 0 | ) |
|
Turn on the linger option. Closing a socket does not wait for for the session to breakdown, unless you have requested it by setting the linger socket option.
void Socket::SetSocketReuse |
( |
| ) |
|
Turn on the resue address option. Allows the socket to be bound to an address that is already in use.
void AppSecInc::TcpIp::Sockets::Socket::Socket::Connect |
( |
const std::wstring & |
ip_addr, |
|
|
unsigned |
port, |
|
|
int |
type = SOCK_STREAM , |
|
|
int |
protocol = IPPROTO_IP |
|
) |
| |
Initialize the socket and connect to a destination. Defaults to TCP, specify SOCK_DGRAM for UDP. See WSASocket reference for more information.
bool AppSecInc::TcpIp::Sockets::Socket::m_connected |
|
protected |
int AppSecInc::TcpIp::Sockets::Socket::m_error |
|
protected |
SOCKET AppSecInc::TcpIp::Sockets::Socket::m_socket |
|
protected |
The documentation for this class was generated from the following files: