ReactOS 0.4.15-dev-8241-g63935f8
CServerClientSocket Class Reference

#include <socket.h>

Inheritance diagram for CServerClientSocket:
Collaboration diagram for CServerClientSocket:

Public Member Functions

 CServerClientSocket ()
 
 CServerClientSocket (LPCServerSocket lpServerSocket)
 
CServerSocketGetServerSocket ()
 
virtual INT Transmit (LPCSTR lpsBuffer, UINT nLength)
 
virtual INT Receive (LPSTR lpsBuffer, UINT nLength)
 
virtual INT SendText (LPCSTR lpsText)
 
virtual VOID MessageLoop ()
 
virtual VOID OnRead ()
 
virtual VOID OnClose ()
 
- Public Member Functions inherited from CSocket
 CSocket ()
 
virtual ~CSocket ()
 
virtual SOCKET GetSocket ()
 
virtual VOID SetSocket (SOCKET socket)
 
virtual SOCKADDR_IN GetSockAddrIn ()
 
virtual VOID SetSockAddrIn (SOCKADDR_IN sockaddrin)
 
virtual VOID SetEvents (LONG lEvents)
 
virtual LONG GetEvents ()
 
virtual VOID SetPort (UINT nPort)
 
virtual VOID Open ()
 
virtual VOID Close ()
 
virtual INT Transmit (LPCSTR lpsBuffer, UINT nLength)
 
virtual INT Receive (LPSTR lpsBuffer, UINT nLength)
 
virtual INT SendText (LPCSTR lpsStr)
 

Protected Attributes

LPCServerSocket ServerSocket
 
- Protected Attributes inherited from CSocket
SOCKET Socket
 
SOCKADDR_IN SockAddrIn
 
WSAEVENT Event
 
UINT Port
 
BOOL Active
 

Detailed Description

Definition at line 98 of file socket.h.

Constructor & Destructor Documentation

◆ CServerClientSocket() [1/2]

CServerClientSocket::CServerClientSocket ( )
inline

Definition at line 100 of file socket.h.

100{};

◆ CServerClientSocket() [2/2]

CServerClientSocket::CServerClientSocket ( LPCServerSocket  lpServerSocket)

Definition at line 103 of file socket.cpp.

104{
105 ServerSocket = lpServerSocket;
106}
LPCServerSocket ServerSocket
Definition: socket.h:111

Member Function Documentation

◆ GetServerSocket()

LPCServerSocket CServerClientSocket::GetServerSocket ( )

Definition at line 149 of file socket.cpp.

150{
151 return ServerSocket;
152}

Referenced by CServerClientThread::~CServerClientThread().

◆ MessageLoop()

VOID CServerClientSocket::MessageLoop ( )
virtual

Definition at line 132 of file socket.cpp.

133{
134 UINT nStatus;
135 WSANETWORKEVENTS NetworkEvents;
136
137 nStatus = WSAWaitForMultipleEvents(1, &Event, FALSE, 0, FALSE);
138 if ((nStatus == 0) && (WSAEnumNetworkEvents(Socket, Event, &NetworkEvents) != SOCKET_ERROR)) {
139 if ((NetworkEvents.lNetworkEvents & FD_READ) != 0) {
140 OnRead();
141 }
142 if ((NetworkEvents.lNetworkEvents & FD_CLOSE) != 0) {
143 OnClose();
144 }
145 }
146}
virtual VOID OnClose()
Definition: socket.h:109
virtual VOID OnRead()
Definition: socket.h:107
SOCKET Socket
Definition: socket.h:89
#define FALSE
Definition: types.h:117
INT WSAAPI WSAEnumNetworkEvents(IN SOCKET s, IN WSAEVENT hEventObject, OUT LPWSANETWORKEVENTS lpNetworkEvents)
Definition: event.c:94
DWORD WSAAPI WSAWaitForMultipleEvents(IN DWORD cEvents, IN CONST WSAEVENT FAR *lphEvents, IN BOOL fWaitAll, IN DWORD dwTimeout, IN BOOL fAlertable)
Definition: event.c:75
unsigned int UINT
Definition: ndis.h:50
#define FD_READ
Definition: winsock.h:405
#define FD_CLOSE
Definition: winsock.h:410
#define SOCKET_ERROR
Definition: winsock.h:333

Referenced by CHttpClient::SendFile().

◆ OnClose()

virtual VOID CServerClientSocket::OnClose ( )
inlinevirtual

Reimplemented in CHttpClient.

Definition at line 109 of file socket.h.

109{};

Referenced by MessageLoop().

◆ OnRead()

virtual VOID CServerClientSocket::OnRead ( )
inlinevirtual

Reimplemented in CHttpClient.

Definition at line 107 of file socket.h.

107{};

Referenced by MessageLoop().

◆ Receive()

INT CServerClientSocket::Receive ( LPSTR  lpsBuffer,
UINT  nLength 
)
virtual

Reimplemented from CSocket.

Definition at line 126 of file socket.cpp.

127{
128 return recv(Socket, lpsBuffer, nLength, 0);
129}
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23
_In_ DWORD nLength
Definition: wincon.h:473

Referenced by CHttpClient::OnRead().

◆ SendText()

INT CServerClientSocket::SendText ( LPCSTR  lpsText)
virtual

Reimplemented from CSocket.

Definition at line 115 of file socket.cpp.

116{
117 static CHAR crlf[3] = {0x0D, 0x0A, 0x00};
118 INT nCount;
119
120 nCount = Transmit(lpsText, strlen(lpsText));
121 nCount += Transmit(crlf, strlen(crlf));
122 return nCount;
123}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
virtual INT Transmit(LPCSTR lpsBuffer, UINT nLength)
Definition: socket.cpp:109
static const WCHAR crlf[]
Definition: object.c:1018
int32_t INT
Definition: typedefs.h:58
char CHAR
Definition: xmlstorage.h:175

Referenced by CHttpClient::Report(), and CHttpClient::SendFile().

◆ Transmit()

INT CServerClientSocket::Transmit ( LPCSTR  lpsBuffer,
UINT  nLength 
)
virtual

Reimplemented from CSocket.

Definition at line 109 of file socket.cpp.

110{
111 return send(Socket, lpsBuffer, nLength, 0);
112}
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23

Referenced by CHttpClient::SendFile(), and SendText().

Member Data Documentation

◆ ServerSocket

LPCServerSocket CServerClientSocket::ServerSocket
protected

Definition at line 111 of file socket.h.

Referenced by CServerClientSocket(), and GetServerSocket().


The documentation for this class was generated from the following files: