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 - Naralas

Pages: [1]
1
Network / Socket try connect multiple times
« on: April 27, 2015, 11:22:22 am »
Hello,

I have a project where I need to check in the network if there's already a server. I'm trying to connect a socket and the first time I call the connect method the socket is able to connect but otherwise it can't. Like the socket can only connect if the adress of the server is the first one to be tested.

for(int i = first ; i <= last; i++)
{ // net_id -> something like "192.168.140", first and last define the set of adresses
    test = net_id;
    test.append(".");
    test.append(std::to_string(i));  // 192.168.140.1, 192.168.140.2, ...
    sf::Socket::Status status = s_test.connect(test,port);
}

2
Network / Crash on selector.wait() with a std::thread
« on: March 03, 2015, 02:34:51 pm »
Hello,

I'm learning to use the threads with the SFML network.
I have a thread (std) for the server on which it listens all the time but I always get the error segementation default on the selector.wait.

My class in which I initialize my thread :

void Application::Start()
{
    Network net1(this->port);
    std::thread server_thread(&Network::Run,&net1);
    server_thread.detach();
}

The run fonction of the network class for the server :

void Network::Run()
{
    listener.listen(this->port);
    while(true)
    {
        if (selector.wait())                          // crash here
        {
            // Test the listener
            if (selector.isReady(listener))
            {
                cout << "Client connected." << endl;
                ...
            }
        }
     }
}

Thanks for your help.

3
General / [Resolved] Problems to use the lib with QtCreator on Ubuntu
« on: November 18, 2014, 11:09:49 am »
Hi,
I'm trying to include the lib on QtCreator but it doesn't work. If I install SFML with sudo apt-get install libsfml-dev I get the errors "undefined reference to...". If I install it "manually" I get the errors "cannot find lsfml-audio-d, lsfm-network-d,...". Here is my .pro file
QT       += core
QT       -= gui
TARGET = test_sfml
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app

SOURCES += main.cpp

LIBS += -L"/home/ludo/SFML/lib"
CONFIG(release, debug|release): LIBS += -lsfml-audio -lsfml-graphics -lsfml-network -lsfml-window -lsfml-system
CONFIG(debug, debug|release): LIBS += -lsfml-audio-d -lsfml-graphics-d -lsfml-network-d -lsfml-window-d -lsfml-system-d
INCLUDEPATH += "/home/ludo/SFML/include"
DEPENDPATH += "/home/ludo/SFML/include"
 
If anyone could help me that would be great.

Pages: [1]