3c45a5651f81e73586b58aea8a9e0cc78bd935de
7 DWORD WINAPI
QotdHandler(VOID
* Sock_
)
17 NumOfQuotes
= 70; // need to emurate the rc file to discover
18 // how many quotes are in there.
20 /* randomise the quote */
21 srand((unsigned int) time(0));
22 QuoteToPrint
= rand() % NumOfQuotes
;
24 LoadString(NULL
, QuoteToPrint
, Quote
, sizeof(Quote
)/sizeof(TCHAR
));
26 SendQuote(Sock
, Quote
);
28 _tprintf(_T("Shutting connection down...\n"));
29 if (ShutdownConnection(Sock
, FALSE
))
30 _tprintf(_T("Connection is down.\n"));
33 _tprintf(_T("Connection shutdown failed\n"));
36 _tprintf(_T("Terminating thread\n"));
43 BOOL
SendQuote(SOCKET Sock
, TCHAR
* Quote
)
48 StringSize
= strlen(Quote
);
49 RetVal
= send(Sock
, Quote
, sizeof(TCHAR
) * StringSize
, 0);
51 if (RetVal
== SOCKET_ERROR
)
54 _tprintf(("Connection closed by peer.\n"));