Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - The_Xlebushek

Pages: [1]
1
Network / TCP doesn't work on remote computer
« on: June 11, 2021, 09:19:43 pm »
I created a simple application that sends a string to another machine. It works fine with both the client and the server connected to the same network, but it doesn't connect to a public address. Wireshark shows that the server is not responding if I send a request to the remote computer.

#include <SFML\Network.hpp>
#include <iostream>

int main()
{
        sf::Packet packet;
        char who;
        std::cout << "Are you a server (s) or a client (c)?" << std::endl;
        std::cin >> who;
        if (who == 's')
        {
                sf::TcpSocket client;
                std::cout << "Public: " << sf::IpAddress::getPublicAddress() << std::endl;
                std::cout << "Local: " << sf::IpAddress::getLocalAddress() << std::endl;
                sf::TcpListener listener;
                if (listener.listen(3005) != sf::Socket::Done)
                        std::cout << "Could not bind port" << std::endl;
                if (listener.accept(client) != sf::Socket::Done)
                        std::cout << "Could not connect to client" << std::endl;
                client.receive(packet);
                std::string name;
                packet >> name;
                std::cout << name << std::endl;
        }
        else if (who == 'c')
        {
                sf::TcpSocket server;
                sf::IpAddress ip;
                std::cin >> ip;
                if (server.connect(ip, 3005) != sf::Socket::Done)
                        std::cout << "Could not connect to server" << std::endl;
                packet << "Some random text";
                server.send(packet);
                std::cout << "Packet was sent" << std::endl;
        }
        system("pause");
}
 

2
Network / ftp.download crash
« on: September 26, 2020, 11:10:12 am »
Tied using this one (ftp.download( "test.txt", "", Ftp::Ascii); ), but my app crashes with windows sending data error. Other functions work properly: I connected to server, changed directory, it even shows me a directory list, and there is a test.txt in it. MinGW isn't showing any errors and compiles the app as always. Changing transfer mode didn't help.

This surprisingly does nothing. The same error.
Ftp::Response x = ftp.download("test.txt", "");
cout << "FTP Download: " << x.getStatus() << " : " << x.getMessage() << "\n";

Using windows 10 and MinGW. Compiling with this:
g++ main.cpp -o main.exe -ID:\\SFML-2.5.1\\include -LD:\\SFML-2.5.1\\lib -lsfml-graphics -lsfml-window -lsfml-system -lsfml-network

Pages: [1]