50 Family = SocketAddress.sa_family;
128 PeerSocketAddress =
newSocket.PeerSocketAddress;
408#if !defined(__GNUC__)
426#if !defined(__GNUC__)
723 WindowNotification(0),
748 SocketParent =
src.SocketParent;
753 if (SocketParent->Handle) {
839 if (socket != SocketParent->Handle)
The TSocketAddress class stores a Winsock socket address.
TSocket encapsulates the basic attributes of a socket.
int GetReuseAddressOption(bool &bAllowReuseAddress)
Retrieves the reusable address option.
int SetKeepAliveOption(bool bKeepAlive)
Sends keepAlive messages.
virtual void SetMaxReadBufferSize(int nNewMaxReadBufferSize)
This should be called by someone who knows what the correct value is.
int GetOOBOption(bool &bSendOOBDataInline)
Retrieves the out-of-band (OOB) option.
virtual ulong GetTotalWaitingSize()
Returns the total number of bytes waiting to be read.
int SetOOBOption(bool bSendOOBDataInline)
Receives out-of-band (OOB) data in the normal data stream.
virtual int DoCloseNotification(const SOCKET &s, int nError)
This isn't responded to in the generic TSocket class.
int SetDebugOption(bool bDebug)
Records debugging info.
virtual int DoReadNotification(const SOCKET &s, int nError)
This function gets called whenever the socket gets a read notification.
virtual int DoConnectNotification(const SOCKET &s, int nError)
This isn't responded to in the generic TSocket class.
virtual int ConvertProtocol(char *protocol)
Converts a string protocol to integer value.
virtual int CreateSocket()
The CreateSocket function is much like the Winsock socket() function.
virtual int CloseSocket()
The CloseSocket() function is much like the Winsock closesocket() function.
virtual int BindSocket()
binds to our address
virtual int GetPeerAddress(TSocketAddress &socketAddress, int &nAddressLength, SOCKET &socket)
The GetPeerAddress() function is much like the Winsock getpeername() function.
virtual int ShutDownSocket(TShutMode shutMode=ShutModeNoRecvSend)
The ShutDownSocket() function is much like the Winsock shutdown() function.
virtual int DoAcceptNotification(const SOCKET &s, int nError)
This isn't responded to in the generic TSocket class.
int SetSendBufferOption(int nSendBufferSize)
Sets the buffer size for sending messages.
int SetReceiveBufferOption(int nReceiveBufferSize)
Sets the buffer size for receiving messages.
virtual int StartRegularNotification()
This function turns on all Winsock notifications except FD_ACCEPT.
TSocket & operator=(TSocket &newSocket)
int GetBroadcastOption(bool &bBroadcast)
Retrieves the current broadcast option.
int Protocol
IPPROTO_TCP, etc.
int SetBroadcastOption(bool bBroadcast)
Allows transmission of broadcast messages.
virtual int GetMyAddress(TSocketAddress &socketAddress, int &nAddressLength, SOCKET &socket)
This function stores the address into the reference argument 'socketAddress'.
short SaveSocket
Save the socket on deletion?
TSocketWindow Window
Will receive internal notifications and pass them to this class.
int Type
SOCK_STREAM, etc.
int SetReuseAddressOption(bool bAllowReuseAddress)
Allows the socket to bind to an already-bound address.
int GetKeepAliveOption(bool &bKeepAlive)
Retrieves the keepAlive option.
TSocket()
Default constructor for a socket.
int SocketsCallCheck(int error)
Checks the return error value from a sockets call, caching the last error if one occured (i....
virtual int DoWriteNotification(const SOCKET &s, int nError)
The generic socket doesn't know how many bytes it can send, since this limit is dependent on whether ...
virtual ~TSocket()
This TSocket destructor will close the socket it if has not be closed already.
virtual int StartCustomNotification(int nSelectionOptions)
The return value is WINSOCK_ERROR or WINSOCK_NOERROR.
void Init()
This function is an intitialization function called by the TSocket constructors.
int GetSendBufferOption(int &nSendBufferSize)
Retrieves the current sending buffer size.
int Family
PF_INET, etc. (this is the protocol family)
TShutMode
How to shutdown the socket.
int GetLingerOption(bool &bLinger, ushort &nLingerTime)
Retreives the current linger option.
virtual ulong GetDriverWaitingSize()
GetDriverWaitingSize() is much like calling ioctlsocket(s, FIONREAD,...) in Winsock.
virtual int CancelNotification()
CancelNotification() turns off the notification to this window.
int GetReceiveBufferOption(int &nReceiveBufferSize)
Retrieves the current receiving buffer size.
int GetDebugOption(bool &bDebug)
Retrieves the current debugging option.
int MaxReadBufferSize
Maximum buffer size.
int SetRouteOption(bool bRoute)
A false argument means don't route.
virtual void SetMyAddress(TSocketAddress &newSocketAddress)
This may be useful for changing the address or setting the address before binding.
virtual int DoOOBNotification(const SOCKET &s, int nError)
This isn't responded to in the generic TSocket class.
virtual void SetSocketStyle(int nNewFamily=PF_INET, int nNewType=SOCK_STREAM, int nNewProtocol=0)
The SetSocketStyle function can be used to set or change some TSocket member data.
int GetRouteOption(bool &bRoute)
Retrieves the routing option.
virtual int StartAcceptNotification()
This function says to listen only to FD_ACCEPT messages.
int SetLingerOption(bool bLinger, ushort nLingerTime=0)
If you set 'linger' to true, then that means to linger for 'lingerTime' seconds.
virtual void SetPeerSocketAddress(TSocketAddress &newPeerSocketAddress)
The 'myPeerSocketAddress' member variable is useful for Datagram sockets because it allows them to sp...
Derived from TWindow, a private window used to catch notification messages.
int StartRegularNotification()
This function turns on all Winsock notifications except FD_ACCEPT.
TWindow * WindowNotification
A second window that can be notified instead of the Socket.
TResult DoNotification(TParam1, TParam2)
DoNotification() is the SocketWindow's protected internal notification system.
int GetLastError()
Return the last error on the socket.
TSocketWindow & operator=(TSocketWindow &src)
From the user's standpoint, the only thing that is required to make two SocketWindows act as equal is...
void SetSocketParent(TSocket *socket)
int StartAcceptNotification()
This function says to only listen to FD_ACCEPT messages.
int CancelNotification()
CancelNotification() turns off the notification to this window.
int NotificationSet
Types of notification to respond to.
int SelectOptions
We need to keep our own copy of this so we can do an assignment operator.
int StartCustomNotification(int selectOptions)
The return value is WINSOCK_ERROR or WINSOCK_NOERROR.
static int getpeername(SOCKET s, struct sockaddr *name, int *nameLen)
static int getsockname(SOCKET s, struct sockaddr *name, int *nameLen)
static int ioctlsocket(SOCKET s, long cmd, ulong *argp)
static int setsockopt(SOCKET s, int level, int optName, LPCSTR optVal, int optLen)
static int shutdown(SOCKET s, int how)
static SOCKET socket(int af, int type, int protocol)
static int WSAGetLastError(void)
static int closesocket(SOCKET s)
static int bind(SOCKET s, struct sockaddr *addr, int nameLen)
static int getsockopt(SOCKET s, int level, int optName, char *optVal, int *optLen)
static int WSAAsyncSelect(SOCKET s, HWND hWnd, uint msg, long event)
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
virtual bool Create()
Creates the window interface element to be associated with this ObjectWindows interface element.
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
int operator==(const TBitSet< T > &bs1, const TBitSet< T > &bs2)
Object Windows Library (OWLNext Core)
@ NotifyRead
Notification of readiness for reading.
@ NotifyAccept
Notification of incoming connections.
@ NotifyOOB
Notification of the arrival of out-of-band data.
@ NotifyWrite
Notification of readiness for writing.
@ NotifyClose
Notification of socket closure.
@ NotifyAll
All notifications.
@ NotifyConnect
Notification of completed connection.
LPARAM TParam2
Second parameter type.
WPARAM TParam1
First parameter type.
General definitions used by all ObjectWindows programs.
#define EV_MESSAGE(message, method)
Response table entry for raw message handling Uses a dispatcher that just forwards WPARAM and LPARAM.
Main header of the Winsock OWL subsystem.
#define N_DEF_MAX_READ_BUFFFER_SIZE
#define MSG_SOCKET_NOTIFY
User-defined message used for socked notifications.