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.


Messages - Niely

Pages: [1] 2 3 ... 7
1
Network / Re: Basic FTP code crashes at runtime
« on: April 24, 2016, 04:16:42 pm »
Windows 8.1 64-bit I'm using G++ 4.9.3, what do I have to download then?
SFML only has up to 4.9.2 and I can't get 4.9.3 because I'm using MinGW.

2
Network / Re: Basic FTP code crashes at runtime
« on: April 24, 2016, 11:59:17 am »
Never mind,
I found all the required DLLs and just had to recompile the program.

But anyway,
The whole Ftp example program is working, but when I choose the download-option I get the exact same error as I described above.

3
Network / Re: Basic FTP code crashes at runtime
« on: April 24, 2016, 11:49:46 am »
No that example also ain't working. I get the error that specific DLLs are missing.
I copied them from the MinGW lib folder, however, it asks for a dll now I can't find in that folder.

4
Network / Re: Basic FTP code crashes at runtime
« on: April 24, 2016, 11:13:54 am »
GDB finds this error:
Quote
Program received signal SIGSEGV, Segmentation fault.
0x6fc61225 in ?? () from c:\users\name\desktop\libstdc++-6.dll
(gdb) continue
Continuing.
[Inferior 1 (process 2652) exited with code 030000000005]
(gdb)
This segmentation fault occurs at line 26.

Maybe I have to mention that I have copied several .dll files to my desktop where the .exe is located.
Otherwise I got the typical error: "Can't start program because X.dll not found".

And all other FTP functions like rename, changeDirectory, login,... are working correctly.

5
Network / Basic FTP code crashes at runtime
« on: April 23, 2016, 03:53:44 pm »
Hello

This basic FTP-code ain't working for some reason. I don't get an error while compiling, but only when running.

Code:
#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Network.hpp>

using namespace std;
int main() {
        sf::Ftp ftp;
        sf::Ftp::Response resp;
       
        //I have emptied these variables for this post
        string server = "";
        string user = "";
        string pass = "";
        string file = "";
        string dest = "";
       
        resp = ftp.connect(server, 21, sf::seconds(120));
        if (!resp.isOk()) cout << resp.getMessage() << " " << resp.getStatus() << endl;
       
        resp = ftp.login(user, pass);
        if (!resp.isOk()) cout << resp.getMessage() << " " << resp.getStatus() << endl;
       
        resp = ftp.download(file, dest, sf::Ftp::Ascii);
        if (!resp.isOk()) cout << resp.getMessage() << " " << resp.getStatus() << endl;
       
        ftp.disconnect();
        cin.ignore().get();
        return 0;
}

G++:
Quote
g++ c:/users/name/desktop/test3.cpp -o c:/users/name/desktop/test3 -lsfml-system -lsfml-network -std=c++11

I am using Windows 8.1, and MinGW to use G++.
I have no compiling errors, only when I execute the executable (test3.exe) I get the "test3.exe doesn't work anymore, search online for solutions ...".

Details of that error:
Probleemhandtekening:
  Gebeurtenisnaam van probleem: APPCRASH
  Naam van de toepassing:       test3.exe
  Versie van toepassing:        0.0.0.0
  Tijdstempel van toepassing:   571b7a03
  Naam van foutmodule:  libstdc++-6.dll
  Versie van foutmodule:        0.0.0.0
  Tijdstempel van foutmodule:   55b39025
  Uitzonderingscode:    c0000005
  Uitzonderingsmarge:   00021225
  Versie van besturingssysteem: 6.3.9600.2.0.0.768.101
  Landinstelling-id:    2067
  Aanvullende informatie 1:     5861
  Aanvullende informatie 2:     5861822e1919d7c014bbb064c64908b2
  Aanvullende informatie 3:     bb02
  Aanvullende informatie 4:     bb02c3b29c3f075104f1d0629e885cfc
 
Translation to English

Also note, that when I request a non existing file on the server, I get a SFML-error but the executable itself doesn't crashes. It only crashes when the file actually does exist...

Why ain't this basic code working?

Thanks!

6
Feature requests / Re: SQL Connector Module
« on: November 07, 2015, 04:52:02 pm »
Getting such code right, efficient and then maintain it all is a lot of work that I don't see our team is having.
Then you need to start thinking of what to support. MySQL, PostgreSQL, SQLite, etc...
Honestly there are a ton of very good, well maintained and iften quite modern libraries out there, that do a way better job than we ever could.

If you're afraid of using libraries, then C++ is not really the place to be... ;)

Well, it's not that I'm afraid of using them (however, sometimes the building and adding to VS can be a real pain). But because I'm still a very beginner in C++ I don't think using tons of libraries are good for learning purposes, If I'd be able to understand the pure code after the libraries, and I'd know what's under the hood, I'd learn more from the language. SFML allows me to inspect that, other's would be harder.

But I understand that such a module indeed would be to much work.
I think I'll go with SQLAPI or maybe even MySQL-Connector/C++.

7
Feature requests / SQL Connector Module
« on: November 06, 2015, 07:50:21 pm »
Hello

A lot of games, and other applications of which the developing can be made easier and more productive using SFML, still require a database (for storing scores, or other data).

But SFML doesn't have an option, feature, or module to connect easily to a (My)SQL-database.
It'd be nice if SFML would have this, because I personally like the style of SFML more than the one of other libraries, and than the developer ain't forced to bloat his program with loads of different libraries; but can stick to a few, or even just one or two.

Maybe, this could be a handy feature for in the (far) future? :)

Thanks for reading,

8
Network / Re: Receiving weird characters when using UDP
« on: October 16, 2015, 10:03:46 pm »

    +--------+                        +---------------------------+
    |        | ---- src = 55001 ----> | ---- randomize port ----> | --- src = 65432 ----+
    |   PC   |                        |          Gateway          |                     |
    |        | <----- ???             |   not mapped : drop <---- | <-- dst = 55001 ----+
    +--------+                        +---------------------------+

 
You made your life harder by using the same port to send and receive. If you use 2 different ports, you could port forward like zsbzsb said, but because you have to get into the hole that your outgoing data came out of, it is all down to guesswork if you use the same port. This is a feature (a good intended one) of stateful firewalls. It is meant to, among other things, protect you and your internal network. Instead of trying to circumvent it, you might want to consider alternate solutions if possible.

Thanks a lot.
I'll be using two different ports, one for receiving and one for sending.

9
Network / Re: Receiving weird characters when using UDP
« on: October 16, 2015, 10:03:00 pm »
Auch, indeed... You're right.
Will this work then, if I do port-forwarding?

Generally ISPs offer a more expensive 'business' plan that includes a static public IP address which would then allow you to handling incoming connections (port forwarding) and host your own server.

So, not everyone can port-forward? Those with a 'cheaper' plan?
How do torrent-protocols and all other p2p applications work then?

10
Network / Re: Receiving weird characters when using UDP
« on: October 15, 2015, 10:45:58 pm »
Is this the way to do it then?
<code>

Well according to binary1248 a UDP socket can receive from itself and as you already said it works so no need for the second socket. But when it comes to sending stuff to your public IP and hoping it gets through that is an entirely different issue. You are most likely behind a NAT from your ISP so there is no way for you to allow incoming connections.

See: http://www.sfml-dev.org/faq.php#network-internet-network

Auch, indeed... You're right.
Will this work then, if I do port-forwarding?

Thanks a lot for the help all, by the way.

11
Network / Re: Receiving weird characters when using UDP
« on: October 15, 2015, 09:09:28 pm »
#include <iostream>
#include <string>
#include <cstring>
#include <SFML/System.hpp>
#include <SFML/Network.hpp>

using namespace std;

int main() {
    sf::UdpSocket socket;
    sf::IpAddress ip = "127.0.0.1";
    unsigned short port = 54000;
    size_t x = 100;
    sf::Socket::Status status;

    socket.bind(54000);

    char data[50] = "Test";

    //Send part
    status = socket.send(data, x, ip, port);
    if (status == sf::Socket::Done) {
        cout << "[Announcement] Packed sended successfull." <<endl;
    } else {
        cout << "[Error] Failed. Error code returned: " << status << " (Send)." <<endl;
    }

    //Receive part
    char receivedPacket[50];
    memset(receivedPacket, 0, 50);
    size_t z;
    status = socket.receive(receivedPacket, x, z, ip , port);
    if (status == sf::Socket::Done) {
        cout << "[Announcement] Packet received succesfull." <<endl;
    } else {
        cout << "[Error] Failed. Error code returned: " << status << " (Receive)." <<endl;
    }

    cout << receivedPacket << endl;

    cin.ignore().get();
}
You didn't bind the socket to a port, so obviously the operating system didn't know where to receive the data from. Using the above code I can receive the test string as expected.

Thanks! This code now indeed works for local IP-address, but it doesn't for the public one.

Dumb statement: but I wasn't aware that the same socket could receive its own data that it just sent (TCP or UDP for that matter). What if you actually open a second socket for receiving and only bind the receiving socket? Oh, and your revised code never binds to a port.

Is this the way to do it then?
#include <iostream>
#include <string>
#include <SFML/System.hpp>
#include <SFML/Network.hpp>

using namespace std;

int main() {
        sf::UdpSocket socket1;
        sf::UdpSocket socket2;
                                                //REPLACE IP ADDRESS HERE!!!
        sf::IpAddress ip = "PUBLIC IP";
        unsigned short port = 55001;
        size_t x = 50;
        sf::Socket::Status status;

        char data[50] = "Test";
       
        //Send part
        status = socket1.send(data, x, ip, port);
        if (status == sf::Socket::Done) {
                cout << "[Announcement] Packed sended successfull." <<endl;
        } else {
                cout << "[Error] Failed. Error code returned: " << status << " (Send)." <<endl;
        }

        //Receive part
        socket2.bind(port);
        char receivedPacket[50] = {"njknjfkz"};
        size_t z;
        status = socket2.receive(receivedPacket, x, z, ip, port);
        if (status == sf::Socket::Done) {
                cout << "[Announcement] Packet received succesfull." <<endl;
        } else {
                cout << "[Error] Failed. Error code returned: " << status << " (Receive)." <<endl;
        }

        cout << endl << "Received: " << receivedPacket << " - " << z <<endl;

        cin.ignore().get();
}
 
Because with this, the sending is successful, but the receiving just don't display.

12
Network / Re: Receiving weird characters when using UDP
« on: October 15, 2015, 07:42:28 pm »
Nope it doesn't. Tried 127.0.0.1, localhost, my ipconfig (local IP in network), and of course my public one. No difference. Firewall is off by the way.

13
Network / Re: Receiving weird characters when using UDP
« on: October 14, 2015, 06:57:16 pm »
Is there already a solution found? Does such a simple network code works for others? I'd like to continue my project.

14
Network / Re: Receiving weird characters when using UDP
« on: October 10, 2015, 09:34:34 pm »
Is this better then?

size_t z;
status = socket.receive(receivedPacket, x, z, ip , port);

Still receiving the same error code with my sockets though.

Full code:
#include <iostream>
#include <string>
#include <SFML/System.hpp>
#include <SFML/Network.hpp>

using namespace std;

int main() {
        sf::UdpSocket socket;
        sf::IpAddress ip = "84.195.14.184";
        unsigned short port = 54000;
        size_t x = 100;
        sf::Socket::Status status;

        char data[50] = "Test";

        //Send part
        status = socket.send(data, x, ip, port);
        if (status == sf::Socket::Done) {
                cout << "[Announcement] Packed sended successfull." <<endl;
        } else {
                cout << "[Error] Failed. Error code returned: " << status << " (Send)." <<endl;
        }

        //Receive part
        char receivedPacket[50];
        size_t z;
        status = socket.receive(receivedPacket, x, z, ip , port);
        if (status == sf::Socket::Done) {
                cout << "[Announcement] Packet received succesfull." <<endl;
        } else {
                cout << "[Error] Failed. Error code returned: " << status << " (Receive)." <<endl;
        }

        cin.ignore().get();
}
 

15
Network / Re: Receiving weird characters when using UDP
« on: October 10, 2015, 07:20:47 pm »

#include <iostream>
#include <string>
#include <SFML/System.hpp>
#include <SFML/Network.hpp>

using namespace std;

int main() {
        sf::UdpSocket socket;
        sf::IpAddress ip = "84.195.14.184";
        unsigned short port = 54000;
        size_t x = 100;
        sf::Socket::Status status;

        char data[50] = "Test";

        //Send part
        status = socket.send(data, x, ip, port);
        if (status == sf::Socket::Done) {
                cout << "[Announcement] Packed sended successfull." <<endl;
        } else {
                cout << "[Error] Failed. Error code returned: " << status << " (Send)." <<endl;
        }

        //Receive part
        char receivedPacket[50];
        status = socket.receive(receivedPacket, sizeof(receivedPacket) +1, x, ip, port);
        if (status == sf::Socket::Done) {
                cout << "[Announcement] Packet received succesfull." <<endl;
        } else {
                cout << "[Error] Failed. Error code returned: " << status << " (Receive)." <<endl;
        }

        cin.ignore().get();
}
 

Tried again from scratch and failed again.
However, I think I saw something strange...

If you look at the receive function on line 27.
When looking at the documentation, the parameters are:
(data, size, received, remoteAddress, remotePort).
Size is the maximum numbers I can receive,
received is the actual number of bytes I received.

So you'd expect, that these should be my parameters:
(receivedPacket, x, sizeof(receivedPacket), ip, port)
x: I manually set a maximum I want to receiver,
sizeof(receivedPacket): Parameter gets (actual) size of packet.

Weird enough, if I take this order I get an error.
Why is that?
I personally don't understand that part.

Pages: [1] 2 3 ... 7