Go to the source code of this file.
◆ RECV_BUF
◆ EchoHandler()
Definition at line 69 of file echo.c.
70{
73
75 {
77 retVal = 1;
78 }
79
81
83 {
85 }
86 else
87 {
89 retVal = 1;
90 }
91
94}
VOID LogEvent(LPCWSTR lpMsg, DWORD errNum, DWORD exitCode, UINT flags)
VOID WINAPI ExitThread(IN DWORD uExitCode)
static BOOL EchoIncomingPackets(SOCKET sock)
BOOL ShutdownConnection(SOCKET sock, BOOL bRec)
◆ EchoIncomingPackets()
Definition at line 15 of file echo.c.
16{
22
23 do
24 {
26 if (readBytes > 0)
27 {
28 swprintf(logBuf,
L"Received %d bytes from client", readBytes);
30
31 totalSentBytes = 0;
32 while (!
bShutdown && totalSentBytes < readBytes)
33 {
34 retVal =
send(
sock, readBuffer + totalSentBytes, readBytes - totalSentBytes, 0);
35 if (retVal > 0)
36 {
37 swprintf(logBuf,
L"Sent %d bytes back to client", retVal);
39 totalSentBytes += retVal;
40 }
42 {
45 }
46 else
47 {
48
49
52 }
53 }
54 }
56 {
59 }
60 }
while ((readBytes != 0) && (!
bShutdown));
61
64
66}
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
int PASCAL FAR WSAGetLastError(void)
Referenced by EchoHandler().