本文整理汇总了C++中ConnectionManager::ShutdownConnection方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionManager::ShutdownConnection方法的具体用法?C++ ConnectionManager::ShutdownConnection怎么用?C++ ConnectionManager::ShutdownConnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionManager
的用法示例。
在下文中一共展示了ConnectionManager::ShutdownConnection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
ConnectionManager connection;
SOCKET connect_socket = connection.CreateClientConnection();
#pragma region WYSYLANIE
#define DEFAULT_BUFLEN 512
int recvbuflen = DEFAULT_BUFLEN;
char *sendbuf = new char[DEFAULT_BUFLEN];
char recvbuf[DEFAULT_BUFLEN];
int result = 0;
do {
printf("Wiadomosc do wyslania: \n");
scanf("%s", sendbuf);
//printf("Wiadomosc jaka wysle: %s\n", sendbuf);
if (strcmp(sendbuf, "quit") == 0) break;
// Send an initial buffer
result = send(connect_socket, sendbuf, static_cast<int>(strlen(sendbuf)), 0);
if (result == SOCKET_ERROR) {
printf("send failed: %d\n", WSAGetLastError());
closesocket(connect_socket);
WSACleanup();
//
getch();
//
return 1;
}
} while (true);
#pragma endregion blok odpowiedzialny za komunikacje z serwerem
connection.ShutdownConnection(connect_socket);
printf("Client exit.\n");
getch();
return 0;
}
示例2: main
int main(int argc, char *argv[])
{
ConnectionManager connection;
SOCKET listen_socket = connection.CreateServerConnection();
SOCKET client_socket;
ProcessesAndThreadsManager process_manager;
while (client_socket = connection.AcceptingConnection(listen_socket)) {
// in there should be process_manager.SetPathToProcess function
char *sciezka = new char[256];
strcpy(sciezka, "F:\\dropbox\\myftp\\MyFTP - ClientsManager\\ClientsManager\\debug\\ClientsManager");
strcat(sciezka, " ");
// copy socket handle to argument list of new process
char str_to_socket[10];
itoa(client_socket, str_to_socket, 10);
strcat(sciezka, str_to_socket);
printf("Sciezka do procesu tuz przed wyslaniem:\n%s\n", sciezka);
USES_CONVERSION;
TCHAR* dziecko = A2T(sciezka);
process_manager.path_to_process_ = dziecko;
process_manager.CreateNewProcess();
}
process_manager.WaitForProcessToEnd();
process_manager.CloseHandles();
printf("Client disconnect.\n");
connection.ShutdownConnection(client_socket);
closesocket(listen_socket);
printf("Server exit.\n");
return 0;
}