Клиент-серверное приложение работает неправильноC++

Программы на C++. Форум разработчиков
Гость
Клиент-серверное приложение работает неправильно

Сообщение Гость »


Когда я запускаю

Код: Выделить всё

server.cpp
then I immediately get the phrase

Код: Выделить всё

"Client Connected!"
, although I have not launched the application for

Код: Выделить всё

client.cpp
yet. When I launch the application for

Код: Выделить всё

client.cpp
, I have nothing output in the console.
I understand that this happens to me because I have an application running

Код: Выделить всё

server.cpp
and the variable

Код: Выделить всё

newConnection
is equal to

Код: Выделить всё

18446744073709551615
for some reason. I tried changing ports, IP addresses, but nothing helps.
server.cpp

Код: Выделить всё

#include //библиотека ввода вывода
#pragma comment(lib, "ws2_32.lib")
#include //библиотека windows для работы с сетью
#pragma warning(disable: 4996)
using namespace std;

int main() {
//подключили библиотеку
WSAData wsaData;
WORD DLLVersion = MAKEWORD(2, 1);
if (WSAStartup(DLLVersion, &wsaData) != 0) {
cout 

Источник: [url]https://stackoverflow.com/questions/78142548/the-client-server-application-is-not-working-correctly[/url]

Вернуться в «C++»