bd29c43900f2630da3f02a474c686638018049f3
3 * Copyright (C) 2005 ReactOS Team
5 * LICENCE: GPL - See COPYING in the top level directory
6 * PROJECT: ReactOS simple TCP/IP services
7 * FILE: apps/utils/net/tcpsvcs/daytime.c
8 * PURPOSE: Provide CharGen, Daytime, Discard, Echo, and Qotd services
9 * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
21 DWORD WINAPI
DaytimeHandler(VOID
* Sock_
)
27 SOCKET Sock
= (SOCKET
)Sock_
;
30 newtime
= localtime(&aclock
);
31 pszTime
= _tasctime(newtime
);
33 SendTime(Sock
, pszTime
);
35 _tprintf(_T("Shutting connection down...\n"));
36 if (ShutdownConnection(Sock
, FALSE
))
37 _tprintf(_T("Connection is down.\n"));
40 _tprintf(_T("Connection shutdown failed\n"));
44 _tprintf(_T("Terminating daytime thread\n"));
49 BOOL
SendTime(SOCKET Sock
, TCHAR
*time
)
51 INT StringSize
= strlen(time
);
52 INT RetVal
= send(Sock
, time
, sizeof(TCHAR
) * StringSize
, 0);
54 if (RetVal
== SOCKET_ERROR
)
57 _tprintf(("Connection closed by peer.\n"));