A basic blocking socket. More...
#include <Socket.h>
Public Member Functions | |
int | GetError () const |
void | ClearError () |
Clear the error from the last failed operation on this socket. | |
SOCKET | Peek () const |
bool | IsCreated () const |
Returns true if the socket has been created. | |
bool | IsConnected () const |
Returns true if the socket has been successfuly connected. | |
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. | |
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. | |
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. | |
void | SetSocketReuse () |
Turn on the resue address option. Allows the socket to be bound to an address that is already in use. | |
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. | |
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. | |
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). | |
void | Bind (const std::string &ip_addr, unsigned port, int type=SOCK_STREAM, int protocol=IPPROTO_IP) |
Bind the socket to an address. | |
Socket () | |
constructor | |
virtual | ~Socket () |
Protected Member Functions | |
virtual void | InternalSetSockOpt (int level, int optname, const char *optval, int optlen) |
Set a socket option. | |
virtual void | InternalIoCtlSocket (long cmd, u_long *argp) |
Control socket IO. | |
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. | |
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. | |
virtual void | InternalShutdown (int how) |
Shutdown a socket. | |
virtual void | InternalClose () |
Close a socket. | |
Protected Attributes | |
SOCKET | m_socket |
int | m_error |
bool | m_connected |
A basic blocking socket.
A basic blocking socket that is bound to a specific transport-service provider.
Socket::Socket | ( | ) |
constructor
Socket::~Socket | ( | ) | [virtual] |
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 struct sockaddr * | name, |
int | namelen | ||
) |
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::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().
void Socket::InternalClose | ( | ) | [protected, virtual] |
Close a socket.
void Socket::InternalConnect | ( | const struct sockaddr * | name, |
int | namelen, | ||
LPWSABUF | lpCallerData = NULL , |
||
LPWSABUF | lpCalleeData = NULL , |
||
LPQOS | lpSQOS = NULL , |
||
LPQOS | lpGQOS = NULL |
||
) | [protected, virtual] |
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 |
||
) | [protected, virtual] |
Create a socket. See WSASocket or ::socket for more information.
void Socket::InternalIoCtlSocket | ( | long | cmd, |
u_long * | argp | ||
) | [protected, virtual] |
Control socket IO.
void Socket::InternalSetSockOpt | ( | int | level, |
int | optname, | ||
const char * | optval, | ||
int | optlen | ||
) | [protected, virtual] |
Set a socket option.
void Socket::InternalShutdown | ( | int | how | ) | [protected, virtual] |
Shutdown a socket.
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] |
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] |
© Application Security Inc. - All Rights Reserved | http://msiext.codeplex.com |