Сервер cpp. Клиент не может подключиться к серверу

Я хочу, чтобы другие люди в разных локальных сетях могли подключаться на мой сервер. То есть я сперва должен зайти в роутер, создать виртуальный сервер с IP адресом моего компьютера в DHCP (192.168.1.101), с портом 1111, с протоколами TCP и UDP. Потом я на стороне сервера (Server.cpp) должен в inet_addr() задать параметр 127.0.0.1 и порт 1111, на стороне клиента я в inet_addr() должен указать белый IP адрес (тот, который можно узнать в https://2ip.ru/) и порт 1111. В итоге запускаю сервер и запускается он нормально, но запускаю клиента и через секунд 10 говорит что не может подключиться к серверу. Не могу понять что я неправильно делаю…

Server.cpp

#include <iostream> #include <WinSock2.h> #include <string> #pragma comment(lib, "ws2_32.lib") #pragma warning (disable: 4996) using namespace std; SOCKET users[10]; string users_name[10]; int user_num = 0; void Users_Msgs(int index)  {     char msg1[256];     while (true)     {         recv(users[index], msg1, sizeof(msg1), 0);         for (int j = 0; j < user_num; j++)         {             if (j == index) continue;             send(users[j], users_name[index].c_str(), users_name[index].length() + 1, 0);             Sleep(250);             send(users[j], msg1, sizeof(msg1), 0);         }     } } int main() {     setlocale(LC_ALL, "ru");     WSAData wsaData;     WORD dll_ver = MAKEWORD(2, 1);     if (WSAStartup(dll_ver, &wsaData) != 0)     {         cout << "Error\n";         exit(1);     }     SOCKADDR_IN addr;     int size_of_addr = sizeof(addr);     addr.sin_addr.s_addr = inet_addr("127.0.0.1");     addr.sin_port = htons(1111);     addr.sin_family = AF_INET;     SOCKET Listen = socket(AF_INET, SOCK_STREAM, 0);     bind(Listen, (SOCKADDR*)&addr, sizeof(addr));     listen(Listen, SOMAXCONN);     SOCKET newConnection;     for (int i = 0; i < 10; i++)     {         newConnection = accept(Listen, (SOCKADDR*)&addr, &size_of_addr);         if (newConnection == 0) cout << "Error connecting to client\n";         else         {             cout << "Connection to client " << i << " succesfully\n";             users[i] = newConnection;             user_num++;             char his_name[256];             recv(newConnection, his_name, sizeof(his_name), 0);             users_name[i] = his_name;             cout << "His name is " << his_name << "\n";             CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Users_Msgs, (LPVOID)(i), 0, 0);         }     }     return 0; } 

Client.cpp

#include <iostream> #include <WinSock2.h> #include <string> #include <windows.h> #pragma comment(lib, "ws2_32.lib") #pragma warning (disable: 4996) using namespace std; SOCKET Connection; void Msg_Rec() {     char msg[256], name[256];     while(true)     {         recv(Connection, name, sizeof(name), 0);         recv(Connection, msg, sizeof(msg), 0);         cout << "\n" <<  name << ": " << msg << "\n";     } } int main() {     setlocale(LC_ALL, "ru");      WSAData wsaData;     WORD dll_ver = MAKEWORD(2, 1);     if (WSAStartup(dll_ver, &wsaData) != 0)     {         cout << "Error\n";         exit(1);     }     SOCKADDR_IN addr;     int size_of_addr = sizeof(addr);     addr.sin_addr.s_addr = inet_addr("127.0.0.1");     addr.sin_port = htons(1111);     addr.sin_family = AF_INET;     Connection = socket(AF_INET, SOCK_STREAM, 0);     if (connect(Connection, (SOCKADDR*)&addr, sizeof(addr)) != 0)     {         cout << "Error connecting to server\n";         system("pause");     }     cout << "Connection to server succesfully\n";     cout << "Enter your name: ";     char your_name[256];     cin >> your_name;     send(Connection, your_name, sizeof(your_name), 0);     CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Msg_Rec, 0, 0, 0);     while(true)     {         char msg[256];         cout << "Enter your message: ";         cin.getline(msg, sizeof(msg)) >> msg;         send(Connection, msg, sizeof(msg), 0);         Sleep(100);     }     system("pause"); } 

Настроил виртуальный сервер на роутере:

Unable to set default program for .cpp file type

I’m using the latest edition of Windows 10 Home on a 64-bit computer.

I’ve been struggling to set the default program used to open .cpp files. At first, it was set to Notepad, but at some point I must have set it to Code::Blocks by accident. I was eventually able to get rid of the association to Code::Blocks, but now .cpp files don’t have any association. The best I can do is set them back to Code::Blocks.

I tried many of the suggestions on this question, but still no luck yet.

I’ve tried multiple ways of setting the default program: Through the Windows 10 Settings app, the typical “Right click and select Open With”, through the Properties window. I even tried NirSoft’s FileTypesMan. One interesting observation I made is that on the File Types Manager, it does say next to the User Choice option “NOTEPAD.EXE”, yet it obviously hasn’t worked yet.

I can get through the whole process of setting the program without an error message or anything, yet their is no visible result.

Any ideas on what I may be doing wrong or what I should try?