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

Pages: 1 [2] 3
16
Network / Re: TCP Server does not react instantly
« on: April 01, 2013, 09:25:10 pm »
Sorry it shouldn't sound selfish(?). I currently can't stream nor upload because my internet is making trouble. I already worked with tcp with .Net and Visual Basic. I already cut off a lot so, it's not the "whole code". It is the network classes I build with the relevant messages and how I send them and a small console workaround to see what is happening. I have just no idea why the first console gets the message it joined, the second parallel console gets the messages that two consoles are there, the third parallel console ... I also tested with a client on a second pc in my LAN. All clients receive a user broadcast by the server so the connections work. Also the client can send the a message to the server but this is extracted out of the example, so the connection works bidirectional. But I don't know why the a client doesn't get a user joined message when an other client joins afterwards.
I think I got why the server doesn't show that what he receives. Maybe the std::getline also stops output because the main thread waits here and everything is put out after I push enter to send a broadcast.

17
Network / TCP Server does not react instantly
« on: April 01, 2013, 08:08:01 pm »
Hey guys,

I'm trying to get small tcp server working. At first I put the project in as attachment. You have to build it for your own due to the upload limitations of the forum. Everything but the network part is cut out. There are some things I don't understand why they are how they are. The server reacts only when I send a broadcast message although it has it's own thread. Also connectings and disconnectings are not send right. Not all receive the messages (there is a pattern due to the order of connects but I can't figure out why it is as it is). I'm currenly doing a video to this. I'll post it in a few minutes.
I hope someone can give me some hints to fix this.

JoshuaBehrens

[attachment deleted by admin]

18
General / Re: Run program outside of Code::Blocks
« on: March 17, 2013, 04:22:18 pm »
Did you have any lib-search-paths/-directories added in Codeblocks? They might have to be added to the environment you execute it. But if you installed sfml right it should be found automagically.

19
Network / Re: Correctly sending post requests to PHP
« on: March 09, 2013, 10:21:19 pm »
You urlencode a string using this small function:
std::string urlencode( const std::string& to )
{
    std::string ret( "" );
    for ( std::size_t c( 0 ) ; c < to.length( ) ; ++c )
    {
        if ( std::isalnum( to[ c ] ) )
            ret += to[ c ];
        else
        {
            char c4[4];
            sprintf( c4, "%%%02X", to[ c ] );
            ret += c4;
        }
    }
    return ret;
}
I use it for this purpose.

20
Network / Re: Correctly sending post requests to PHP
« on: March 09, 2013, 06:23:14 pm »
maybe the LuaScript interrupts the bodypattern. I think the params must be urlencoded although it's post.

21
Network / Re: SFML 2RC crashes undebuggable when downloading a file
« on: March 09, 2013, 03:41:15 pm »
Well I just recompiled all ... and well it works now. Creepy sfml-bins I have. I have no idea why they were not named sfml 2. But it worked as you can see here: http://de.twitch.tv/joshuabehrens/b/375614633

23
Network / Re: SFML 2RC crashes undebuggable when downloading a file
« on: March 09, 2013, 11:42:08 am »
I start C::B as admin (so the toolchain should too?) I just link against network and system using this command: -lsfml-network-d -lsfml-system-d, SFML_STATIC is not defined due to this snippet in front
#ifdef SMFL_STATIC
    #error does not work with static
#endif // SMFL_STATIC
and it compiled fine.

The compiled application asks for sfml-network-d-2.dll, but I only have sfml-network-d.dll from the compilation of SFML 2. I renamed the dll then I throws this error.

than I just say I used the latest SFML 2 ^^

I would also be fine when I have to use boost::asio, because it's just about a filedownload, but SFML has an easier interface for http.

24
Network / Re: SFML 2RC crashes undebuggable when downloading a file
« on: March 09, 2013, 10:52:59 am »
Well ... Exploiter ... you helped me to compile the RC last time :D not a week ago

After a restart it started (started c::b with adminrights) and now he complains that he could not find "_ZN2sf4Http11sendRequestERKNS0_7RequestENS_4TimeE" in DLL "sfml-network-d-2.dll".

25
Hello guys,

I tried this:
#include <SFML/Network.hpp>

#include <map>
#include <list>
#include <string>
#include <cstdio>

bool retrieveLines( const std::string& url, const std::string& file, const std::map< std::string, std::string >& params, std::list< std::string >& out )
{
    sf::Http http( url );
    sf::Http::Request req( file );
    req.setMethod(sf::Http::Request::Get);
    req.setBody("");
    req.setHttpVersion(1, 0);
    for ( std::map< std::string, std::string >::const_iterator cit( params.begin( ) ) ; cit != params.end( ) ; ++cit )
        req.setField( cit->first, cit->second );

    sf::Http::Response res = http.sendRequest( req );

    if ( res.getStatus( ) == 200 )
    {
        printf( "body from %s:\n%s\n", url.c_str( ), res.getBody( ).c_str( ) );
        return true;
    }
    return false;
}

int main( int argc, char** args )
{
    std::map< std::string, std::string > pars;
    std::list< std::string > lines;
    retrieveLines( "joshua-behrens.de","/index.php", pars, lines );

    return 0;
}
But it always closed my console with a very high return number. It is also undebuggable. gdb stops neither on any breakpoint nor any other point where an error could occur. But gdb is fine in other projects. DLLs are with the console, I linked against network-d and system-d. Any hints?
Thanks in advance, JoshuaBehrens

26
General / Re: CodeBlocks 12.11 SFML 2.0
« on: March 03, 2013, 05:31:11 pm »
It should be implemented by including Graphics. But well that was it. Debug and Release target are working. Thanks to all the people especially to Steef and Exploiter for their last hints that fixed it all.

27
General / Re: CodeBlocks 12.11 SFML 2.0
« on: March 03, 2013, 02:42:24 am »
Well thank you exploiter,

at first I was quite confused that you have a German localization but you are speaking a quite good English to me so I wouldnt had identified you as a German-speaking person. I didn't anything different to you BUT I downloaded the 2.0RC from the downloadpage from sfml-dev.org and not from github and with the Codeblocks-project I testet the target "All" and the compiled binaries with my projects. Thanks for the video to show me the missing points. The release builds are working, but not the debug build. I tested with the code of the threadcreator. In debug target it's starting and throws a sigsev because window is 0 following the call stack:
#06E182A92sf::Window::Window(this=0x0)(C:\Users\User\Downloads\SFML-master\SFML-master\src\SFML\Window\Window.cpp:47)
#168ED61D1sf::RenderWindow::RenderWindow(this=0x0, mode=..., title=..., style=2686732, settings=...)(C:\Users\User\Downloads\SFML-master\SFML-master\src\SFML\Graphics\RenderWindow.cpp:42)
 
#2004014DFmain()(C:\Users\User\CBP\Test\main.cpp:5)
And looking at the comments in the code makes it clear why it is 0 but how to fix this without using the obvious one(adding the call to the base class constructor) because it is not advised?
#1:
/*44*/Window::Window() :
/*45*/m_impl          (NULL),
/*46*/m_context       (NULL),
/*47*/m_frameTimeLimit(Time::Zero)
/*48*/{
/*49*/
/*50*/}
#2:
/*42*/RenderWindow::RenderWindow(VideoMode mode, const String& title, Uint32 style, const ContextSettings& settings)
/*43*/{
/*44*/    // Don't call the base class constructor because it contains virtual function calls
/*45*/    create(mode, title, style, settings);
/*46*/}

28
General / Re: CodeBlocks 12.11 SFML 2.0
« on: March 02, 2013, 10:47:45 pm »
I just chose "Codeblocks MinGW", specified the c and c++ compiler and now I let it compile it with CB. It just took me 98 seconds. Maybe CB detects my cores automagically. But using the dll compiled via CB gives the same error. In my other project. For making it simple for me to use a external library I have a second folder for all the external libraries I download or test or whatelse and have it in the search directories for the compiler itself. I would be thankful for a video and thanks for the hint where the dlls are for cc1.exe, helped me a lot.
I see no reason why to put SFML in my projects directly.

29
General / Re: CodeBlocks 12.11 SFML 2.0
« on: February 23, 2013, 04:00:31 pm »
Everything the same the threadcreator posted (except the file path). I'm using his code, codeblocks 12.11, the mingw thats shipped with it(for testing your libs not) and that the VideoMode::ContexSettings are undefined referenced. I would also give you access via teamviewer to my machine to make it work :/ Or stream you what I do via skype or twitch.

30
General / Re: CodeBlocks 12.11 SFML 2.0
« on: February 23, 2013, 03:52:38 pm »
That was a page that I should have found before. But I changed everything: I installed a mingw packet that your page uses, changed the toolchain to it, changed the compiler settings for the project, used the related libs that you compile (debug dynamic) and pressed recompile all. Still the same error undefined reference...

Pages: 1 [2] 3
anything