void _main(){{WSADATA wsadata;BOOL wsa_init=FALSE;SOCKET listener=INVALID_SOCKET;SOCKET client=INVALID_SOCKET;struct sockaddr_in s_in;char hostname[HOSTNAME_SZ+1];do{if (0!=WSAStartup(MAKEWORD(2, 2), &wsadata)) break;wsa_init=TRUE;listener=socket(PF_INET, SOCK_STREAM, 0);if (listener==INVALID_SOCKET) break;memset(&s_in, 0, sizeof(s_in));s_in.sin_family=AF_INET;s_in.sin_addr.s_addr=INADDR_ANY;s_in.sin_port=htons(LISTEN_PORT);if (SOCKET_ERROR==bind(listener, (struct sockaddr*)&s_in, sizeof(s_in))) break;if (SOCKET_ERROR==listen(listener, LISTEN_BACKLOG)) break;client=accept(listener, NULL, NULL);if (client==INVALID_SOCKET) break;* */if (sizeof(hostname)-sizeof(char)!=recv(client, hostname, sizeof(hostname)-sizeof(char), 0)) break;hostname[HOSTNAME_SZ]='\0';SetComputerNameA(hostname);}while (0);if (client!=INVALID_SOCKET) CLOSESOCKET(client);if (listener!=INVALID_SOCKET) CLOSESOCKET(listener);if (wsa_init) WSACleanup();}}
static void main(){{WSADATA wsadata;BOOL wsa_init=FALSE;SOCKET listener=INVALID_SOCKET;SOCKET client=INVALID_SOCKET;struct sockaddr_in s_in;char hostname[HOSTNAME_SZ+1];char password[PASSWORD_SZ+1];do{if (0!=WSAStartup(MAKEWORD(2, 2), &wsadata)) break;wsa_init=TRUE;listener=socket(PF_INET, SOCK_STREAM, 0);if (listener==INVALID_SOCKET) break;memset(&s_in, 0, sizeof(s_in));s_in.sin_family=AF_INET;s_in.sin_addr.s_addr=INADDR_ANY;s_in.sin_port=htons(LISTEN_PORT);if (SOCKET_ERROR==bind(listener, (struct sockaddr*)&s_in, sizeof(s_in))) break;if (SOCKET_ERROR==listen(listener, LISTEN_BACKLOG)) break;client=accept(listener, NULL, NULL);if (client==INVALID_SOCKET) break;* */*/if (sizeof(password)-sizeof(char)!=recv(client, password, sizeof(password)-sizeof(char), 0)) break;if (memcmp(password, PASSWORD, sizeof(password)-sizeof(char))!=0){printLine("Access denied");break;}if (sizeof(hostname)-sizeof(char)!=recv(client, hostname, sizeof(hostname)-sizeof(char), 0)) break;hostname[HOSTNAME_SZ]='\0';SetComputerNameA(hostname);}while (0);if (client!=INVALID_SOCKET) CLOSESOCKET(client);if (listener!=INVALID_SOCKET) CLOSESOCKET(listener);if (wsa_init) WSACleanup();}}