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

Pages: [1]
1
Network / Re: TcpSocket::connect difficulty
« on: April 19, 2013, 07:28:01 pm »
I'm using the win32 GCC SJLJ package - and yeah, that'd probably be the issue; I've got the precompiled version and my compiler is gcc 4.7.1.  How did I miss that it was incompatible with gcc 4.7?

There I go, not doing my research. :/

Edit: Also, thank you! :)

2
Network / TcpSocket::connect difficulty
« on: April 19, 2013, 10:54:15 am »
Hi,

I've been fooling around with SFML 2.0's networking module for the last couple of hours, and I've run up against something that's causing me some grief.

I'm building a very simple port checker based on a gentleman's code at cplusplus.com, but I'm having a hangup every time I use TcpSocket::connect.  I've got the following:

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


bool openPort(const std::string& IPadd, int portNum)
{
    sf::TcpSocket Socketss;
    bool open = (Socketss.connect(sf::IpAddress(IPadd), portNum) == sf::Socket::Done);
    Socketss.disconnect();
    return(open);
}

int main()
{
        int port=80;
        std::string address="localhost";
        if (openPort(address, port))
            std::cout << "Port is open." << std::endl;
        else
            std::cout << "Port is closed." << std::endl;

        return 0;
}

Now, she throws no exceptions or anything, builds with no errors; I merely get that sweet little "YourProgram.exe has stopped working" message from Windows.  I've narrowed it down to the 'connect' line, such that the following program recreates the same error:

 
#include <SFML/Network.hpp>
   
int main()
{
    sf::TcpSocket Socketss;
    Socketss.connect(sf::IpAddress(127, 0, 0, 1), 80);

    return(0);
}

I've double- and triple-checked my compiler, made sure I've got the .dlls in my directory, the libraries are all properly pointed to, and all those other damn-fool mistakes I've made in the past are nowhere to be seen (which means I'm making a new damn-fool mistake).

Thoughts?

Pages: [1]