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

Author Topic: Non-Blocking TCP Freeze [Fixed]  (Read 31670 times)

0 Members and 3 Guests are viewing this topic.

Jungletoe

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Non-Blocking TCP Freeze [Fixed]
« on: April 22, 2013, 01:17:32 am »
Ok, so I've been posting my problems on this thread, which I previously believed were due to networking errors. After further investigation, I realized that the problem is rooted in the sound devices.

I've reinstalled openAL using the libraries provided with SFML, so it's not that.

Here is what Very Sleepy presents me:


If you look at the right hand side on the callstack, it appears that it freezes while playing sounds Here is another snapshot I took:


With this callstack freeze, it appears that it is trying to create a sound instead. Very odd.

Here is my SoundHandler.hpp

#ifndef __SOUNDHANDLER_HPP__
#define __SOUNDHANDLER_HPP__

#include "SFML/System.hpp"
#include "SFML/Audio.hpp"
#include <vector>

class SoundHandler
{
        private:
                sf::Clock timer;

                //////////////////////////
                //                Sounds                //
                //////////////////////////

                sf::SoundBuffer clickBuffer;
                sf::Sound clickSFX;

                sf::SoundBuffer chopBuffer;
                sf::Sound chopSFX;

                sf::SoundBuffer leavesBuffer;
                sf::Sound leavesSFX;

                sf::SoundBuffer windBuffer;
                sf::Sound windSFX;

                sf::SoundBuffer stormBuffer;
                sf::Sound stormSFX;

                sf::SoundBuffer rockBuffer;
                sf::Sound rockSFX;

                sf::Music deathSFX;

                sf::SoundBuffer blood1Buffer;
                sf::Sound blood1SFX;

                sf::Music birdSFX;

                sf::SoundBuffer killBuffer;
                sf::Sound killSFX;

                sf::SoundBuffer popBuffer;
                sf::Sound popSFX;

                sf::SoundBuffer splatBuffer;
                sf::Sound splatSFX;

                sf::SoundBuffer chargeBuffer;
                sf::Sound chargeSFX;

                sf::SoundBuffer splashBuffer;
                sf::Sound splashSFX;

                sf::SoundBuffer waterBuffer;
                sf::Sound waterSFX;

                sf::SoundBuffer fireBuffer;
                sf::Sound fireSFX;

                sf::Music cricketsSFX;

                sf::Music musicboxSFX;

                sf::Music combatSFX;

                sf::SoundBuffer typeBuffer;
                sf::Sound typeSFX;

                sf::Music feetSFX;

                sf::SoundBuffer puffBuffer;
                sf::Sound puffSFX;

                sf::SoundBuffer stabBuffer;
                sf::Sound stabSFX;

                //////////////////////////
                //                Music                 //
                //////////////////////////

                std::vector<sf::Int32> playlist;
                sf::Int32 playNumber;
                sf::Music ambient1;
                sf::Music ambient2;
                sf::Music ambient3;
                sf::Music ourHome;
                sf::Music fishing;
                sf::Music intro;
                sf::Music night;
                sf::Music main;
                bool firstPlayed;

                //      Other vars
                bool soundMuted;
                bool musicMuted;

        public:
                SoundHandler();
                void load();
                void handleMusic();
                void stopMusic();
                bool musicOn;
                void muteMusic();
                void muteSound();

                bool playClick();
                void stopClick();

                bool playWind();
                void stopWind();

                bool playChop();
                void stopChop();

                bool playLeaves();
                void stopLeaves();

                bool playStorm();
                void stopStorm();

                bool playRock();
                void stopRock();

                bool playDeath();
                void stopDeath();

                bool playBlood1();
                void stopBlood1();

                bool playBirds();
                void stopBirds();

                bool playKill();
                void stopKill();

                bool playPop();
                void stopPop();

                bool playSplat();
                void stopSplat();

                void playCharge();
                void resetCharge();

                void playFishing();
                void stopFishing();

                void playSplash();

                void playWater();

                void playCrickets();
                void stopCrickets();

                void playMain();

                void playNight();

                void playFire();

                void playMusicbox();
                void stopMusicbox();

                void playCombat();

                void playType();

                void playFeet();

                void playPuff();

                void playStab();
};

#endif
 


...and my SoundHandler.cpp

#include "stdafx.h"
#include <random>
#include <time.h>
#include "SoundHandler.hpp"
#include "Globals.hpp"

SoundHandler::SoundHandler()
{
        load();
        musicMuted = false;
        soundMuted = false;
}

void SoundHandler::load()
{
        //////////////////////////
        //                Sounds                //
        //////////////////////////

        clickBuffer.loadFromFile("rsc/SFX/click.ogg");
        clickSFX.setBuffer(clickBuffer);

        chopBuffer.loadFromFile("rsc/SFX/chop.ogg");
        chopSFX.setBuffer(chopBuffer);

        leavesBuffer.loadFromFile("rsc/SFX/leaves.ogg");
        leavesSFX.setBuffer(leavesBuffer);

        windBuffer.loadFromFile("rsc/SFX/wind.ogg");
        windSFX.setBuffer(windBuffer);
        windSFX.setLoop(true);

        stormBuffer.loadFromFile("rsc/SFX/storm.ogg");
        stormSFX.setBuffer(stormBuffer);

        rockBuffer.loadFromFile("rsc/SFX/rock.ogg");
        rockSFX.setBuffer(rockBuffer);

        deathSFX.openFromFile("rsc/SFX/death.ogg");

        blood1Buffer.loadFromFile("rsc/SFX/blood1.ogg");
        blood1SFX.setBuffer(blood1Buffer);

        birdSFX.openFromFile("rsc/SFX/birds.ogg");

        killBuffer.loadFromFile("rsc/SFX/kill.ogg");
        killSFX.setBuffer(killBuffer);

        popBuffer.loadFromFile("rsc/SFX/pop.ogg");
        popSFX.setBuffer(popBuffer);

        splatBuffer.loadFromFile("rsc/SFX/splat.ogg");
        splatSFX.setBuffer(splatBuffer);

        chargeBuffer.loadFromFile("rsc/SFX/charge.ogg");
        chargeSFX.setBuffer(chargeBuffer);
        resetCharge();

        splashBuffer.loadFromFile("rsc/SFX/splash.ogg");
        splashSFX.setBuffer(splashBuffer);

        waterBuffer.loadFromFile("rsc/SFX/water.ogg");
        waterSFX.setBuffer(waterBuffer);
        waterSFX.setVolume(25);

        cricketsSFX.openFromFile("rsc/SFX/crickets.ogg");

        fireBuffer.loadFromFile("rsc/SFX/fire.ogg");
        fireSFX.setBuffer(fireBuffer);

        musicboxSFX.openFromFile("rsc/SFX/musicbox.ogg");
        musicboxSFX.setLoop(true);

        combatSFX.openFromFile("rsc/SFX/combat.ogg");

        typeBuffer.loadFromFile("rsc/SFX/type.ogg");
        typeSFX.setBuffer(typeBuffer);

        feetSFX.openFromFile("rsc/SFX/feet.ogg");

        puffBuffer.loadFromFile("rsc/SFX/puff.ogg");
        puffSFX.setBuffer(puffBuffer);

        stabBuffer.loadFromFile("rsc/SFX/stab.ogg");
        stabSFX.setBuffer(stabBuffer);

        //////////////////////////
        //                Music                 //
        //////////////////////////

        //      Day Playlist
        ourHome.openFromFile("rsc/Music/ourHome.ogg");                  //      0
        playlist.push_back(0);
        ambient1.openFromFile("rsc/Music/ambience1.ogg");               //      1
        playlist.push_back(1);
        ambient2.openFromFile("rsc/Music/ambience2.ogg");               //      2
        playlist.push_back(2); 
        night.openFromFile("rsc/Music/night.ogg");                              //      3
        playlist.push_back(3);
        ambient3.openFromFile("rsc/Music/ambience3.ogg");               //      4
        playlist.push_back(4);

        musicOn = true;
        firstPlayed = false;
        srand(time(NULL));
        std::random_shuffle(playlist.begin(), playlist.end());
        playNumber = 0;

        //      Fishing
        fishing.openFromFile("rsc/Music/fishing.ogg");
        fishing.setLoop(true);

        //      Intro
        intro.openFromFile("rsc/Music/intro.ogg");
        intro.setLoop(true);

        //      Main
        main.openFromFile("rsc/Music/The Colony.ogg");
        main.setLoop(true);
}

void SoundHandler::handleMusic()
{
        if(((timer.getElapsedTime().asSeconds() >= 300) || ((!firstPlayed) && (timer.getElapsedTime().asSeconds() >= 60))) && musicOn && !musicMuted)
        {
                firstPlayed = true;
                sf::Int32 songNumber = playlist[playNumber];
                bool restartTimer = true;

                if(songNumber == 0)
                {
                        ourHome.play();
                }

                else if(songNumber == 1)
                {
                        ambient1.play();
                }

                else if(songNumber == 2)
                {
                        ambient2.play();
                }

                else if((songNumber == 3))
                {
                        if((gl::Vars::timeOfDay == NIGHT) || (gl::Vars::timeOfDay == DAWN) || (gl::Vars::timeOfDay == DAWN))
                                night.play();
                        else
                                restartTimer = false;
                }

                else if((songNumber == 4))
                {
                        ambient3.play();
                }

                if(restartTimer)
                        timer.restart();

                playNumber++;
                if(playNumber >= playlist.size())
                {
                        srand(time(NULL));
                        std::random_shuffle(playlist.begin(), playlist.end());
                        playNumber = 0;
                }
        }

        else if(timer.getElapsedTime().asSeconds() >= 300)
        {
                timer.restart();
        }
}

void SoundHandler::stopMusic()
{
        ourHome.stop();
        ambient1.stop();
        ambient2.stop();
        ambient3.stop();
        fishing.stop();
        intro.stop();
        night.stop();
        musicboxSFX.stop();
        main.stop();
}

void SoundHandler::muteMusic()
{
        musicMuted = !musicMuted;

        if(!musicMuted)
                stopMusic();
}

void SoundHandler::muteSound()
{
        soundMuted = !soundMuted;
        windSFX.stop();
        feetSFX.stop();
        cricketsSFX.stop();
        birdSFX.stop();
}

bool SoundHandler::playChop()
{
        if(!soundMuted)
                chopSFX.play();
        return true;
}

void SoundHandler::stopChop()
{
        chopSFX.stop();
}

bool SoundHandler::playClick()
{
        if(!soundMuted)
                clickSFX.play();
        return true;
}

void SoundHandler::stopClick()
{
        clickSFX.stop();
}

bool SoundHandler::playLeaves()
{
        if(!soundMuted)
                leavesSFX.play();
        return true;
}

void SoundHandler::stopLeaves()
{
        leavesSFX.stop();
}

bool SoundHandler::playWind()
{
        if(!soundMuted)
                windSFX.play();
        return true;
}

void SoundHandler::stopWind()
{
        windSFX.stop();
}

bool SoundHandler::playStorm()
{
        if(!soundMuted)
                stormSFX.play();
        return true;
}

void SoundHandler::stopStorm()
{
        stormSFX.stop();
}

bool SoundHandler::playRock()
{
        if(!soundMuted)
                rockSFX.play();
        return true;
}

void SoundHandler::stopRock()
{
        rockSFX.stop();
}

bool SoundHandler::playDeath()
{
        if(!musicMuted)
                deathSFX.play();
        return true;
}

void SoundHandler::stopDeath()
{
        deathSFX.stop();
}

bool SoundHandler::playBlood1()
{
        if(!soundMuted)
                blood1SFX.play();
        return true;
}

void SoundHandler::stopBlood1()
{
        blood1SFX.stop();
}

bool SoundHandler::playBirds()
{
        if(!soundMuted)
                birdSFX.play();
        return true;
}

void SoundHandler::stopBirds()
{
        birdSFX.stop();
}

bool SoundHandler::playKill()
{
        if(!soundMuted)
                killSFX.play();
        return true;
}

void SoundHandler::stopKill()
{
        killSFX.stop();
}

bool SoundHandler::playPop()
{
        if(!soundMuted)
                popSFX.play();
        return true;
}

void SoundHandler::stopPop()
{
        popSFX.stop();
}

bool SoundHandler::playSplat()
{
        if(!soundMuted)
                splatSFX.play();
        return true;
}

void SoundHandler::stopSplat()
{
        splatSFX.stop();
}

void SoundHandler::playCharge()
{
        if(!soundMuted)
                chargeSFX.play();
        chargeSFX.setPitch(chargeSFX.getPitch() + .1);
}

void SoundHandler::resetCharge()
{
        chargeSFX.setPitch(.1);
}

void SoundHandler::playFishing()
{
        if(!musicMuted)
                fishing.play();
}

void SoundHandler::stopFishing()
{
        fishing.stop();
}

void SoundHandler::playSplash()
{
        if(!soundMuted)
                splashSFX.play();
}

void SoundHandler::playWater()
{
        waterSFX.setPitch((rand() % 20) * .1 + .1);
        if(!soundMuted)
                waterSFX.play();
}

void SoundHandler::playCrickets()
{
        if(!soundMuted)
                cricketsSFX.play();
}

void SoundHandler::stopCrickets()
{
        if(!soundMuted)
                cricketsSFX.stop();
}

void SoundHandler::playMain()
{
        if(!musicMuted)
                main.play();
}

void SoundHandler::playNight()
{
        if(!soundMuted)
                night.play();
}

void SoundHandler::playFire()
{
        if(!soundMuted)
                fireSFX.play();
}

void SoundHandler::playMusicbox()
{
        musicOn = false;
        stopMusic();
        musicboxSFX.stop();
        if(!soundMuted && !musicMuted)
        {
                musicboxSFX.play();
                stabSFX.play();
        }
}

void SoundHandler::stopMusicbox()
{
        musicboxSFX.stop();
}

void SoundHandler::playCombat()
{
        if(!soundMuted)
                combatSFX.play();
}

void SoundHandler::playType()
{
        if(!soundMuted)
                typeSFX.play();
}

void SoundHandler::playFeet()
{
        if(!soundMuted)
                feetSFX.play();
}

void SoundHandler::playPuff()
{
        if(!soundMuted)
                puffSFX.play();
}

void SoundHandler::playStab()
{
        if(!soundMuted)
                stabSFX.play();
}
 

For the sake of "minimal and complete examples", here is an example main function:
#include "SoundHandler.hpp"

int main()
{
        SoundHandler soundHandler;
        soundHandler.load();
        soundHandler.handleMusic();
        soundHandler.playCombat();

        return 0;
}
 

Of course, this probably will not crash it since it crashes randomly when I play sounds. I haven't been able to solidly reproduce it yet repeatedly, so I apologize for lack of information.

My guess is that it may have to do with music being loaded at the same time as sounds? That's just a guess from my debugging, but I can't be sure.

All of the sounds are <1 second and the music is anywhere from 30 secs to 5 minutes.

Also, this occasionally gets output in my console and in other's:


Any ideas?
« Last Edit: June 07, 2013, 02:36:56 am by Jungletoe »

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Sound freezes
« Reply #1 on: April 23, 2013, 11:43:12 am »
no idea but you should consider using std::map or alike to reduce your code duplication and increase its flexibility !  ;)
SFML / OS X developer

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Sound freezes
« Reply #2 on: April 23, 2013, 02:26:01 pm »
std::random_shuffle(playlist.begin(), playlist.end());
This is a very critical line of code. You essentially copy/move the sf::Music objects around in order to shuffle them. sf::Music contains an sf::Mutex and holds a pointer to sf::SoundFile which are both NonCopyable. I have no idea how your compiler copies objects which contain NonCopyable objects but if you ask me this shouldn't be allowed. If you are compiling with C++11 then std::random_shuffle might invoke the default move constructors for those classes which might or might not do what is required to ensure expected behaviour.

You should try storing the sounds in a std::map as Hiura already recommended. That way you would only have to shuffle the keys to your Sounds/Music instead of the objects themselves. Maybe that will solve the problem you are experiencing.

On a side note. Laurent has to make sure that objects that shouldn't be moved if C++11 is enabled also get something like sf::NonMoveable. I don't want to know what happens when you move an object while it is being accessed in another thread  :-\.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Sound freezes
« Reply #3 on: April 23, 2013, 03:23:04 pm »
Quote
This is a very critical line of code. You essentially copy/move the sf::Music objects around in order to shuffle them.
His playlist variable is a container of integers.

Quote
On a side note. Laurent has to make sure that objects that shouldn't be moved if C++11 is enabled also get something like sf::NonMoveable. I don't want to know what happens when you move an object while it is being accessed in another thread
If I remember correctly, the conditions for a compiler-generated move constructor are quite strict. I don't think you get one if a user-defined copy constructor exists.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Sound freezes
« Reply #4 on: April 23, 2013, 06:37:35 pm »
In C++11, the automatic generation of the Big Five* is disabled as soon as at least one of them is defined by the user. One can use =default to explicitly provide them without writing a definition.

____________
* Big Five: Copy constructor, move constructor, copy assignment operator, move assignment operator, destructor
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Jungletoe

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Re: Sound freezes
« Reply #5 on: April 24, 2013, 12:58:33 am »
I'm not using C++11.

Quote
This is a very critical line of code. You essentially copy/move the sf::Music objects around in order to shuffle them.
His playlist variable is a container of integers.

Umm... so what do I do? What's the exact problem?

I think it may have something to do with exhausting OpenAL resources, but I'm not sure.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Sound freezes
« Reply #6 on: April 24, 2013, 01:46:35 am »
The problem is... that there is no apparent problem :P. Or at least no easily testable hypothesis. Your code is still too "large" to isolate a single source. Does this problem only arise when you have every single line you posted? Also instead of manually running the application many times over, can't you reproduce it by throwing that main() code into a loop and letting it run until it crashes? Also, you might want to check the return values of your sound loading. It might be that a sound fails to load (completely) and you try to play it resulting in a crash.

The callstack doesn't help much unless you can trace it all the way back to an SFML call. For some reason OpenAL isn't as open as one might think and doesn't make it easy to debug applications making use of it. I don't even want to start about debugging using Windows system calls and multiple threads. That is almost like fortune telling.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Jungletoe

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Re: Sound freezes
« Reply #7 on: April 27, 2013, 07:26:53 pm »
Yeah... so after doing more digging, I don't think it's a sound problem after all since it's not even freezing apparently.

I finally reproduced the bug. Basically, the screen keep drawing but packets are failing to be received. I posted my recv() function over on the other thread... so this is kind of pissing me off. I don't know what else I can do. No packets with the error status are being reported either...

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Sound freezes
« Reply #8 on: April 27, 2013, 07:38:46 pm »
Like I said, capture the packets using Wireshark and show us the dump. If the data isn't arriving then there is nothing to be received. But then TCP should close the connection if it doesn't recover and you should see TCP sending a RST. If the data does arrive but your code doesn't get the data then either there is something wrong with SFML or there is something wrong with your code. If the former is the case, then it should be reproducible with a minimal code example. If you can't reproduce it then you can use the minimal code to figure out what the difference is that is causing the problem.

Save yourself the unneeded trouble and verify whether the data is indeed arriving or not arriving at the client. It isn't that hard to install Wireshark and start capturing packets. Just filter out everything that is not specific to your application and post the dumps somewhere for us to inspect.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Jungletoe

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Re: Sound freezes
« Reply #9 on: April 28, 2013, 06:00:42 am »
I filtered and dumped everything here. After I froze, it seemed to not get any more packets on Wireshark except 4 extras which randomly came in (2 were even from UDP, which is odd).

http://www.mediafire.com/?bzjp2u7u3lumcw9

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Sound freezes
« Reply #10 on: April 28, 2013, 07:44:05 am »
This is only a dump of one way traffic. Provide the traffic in the other direction as well. It is hard to understand whether TCP is working correctly if you can only see one direction. Also provide the same for the other host (send and receive) so that you can compare both with each other and discover discrepancies.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Jungletoe

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Re: Sound freezes
« Reply #11 on: April 28, 2013, 07:01:43 pm »
This is only a dump of one way traffic. Provide the traffic in the other direction as well. It is hard to understand whether TCP is working correctly if you can only see one direction. Also provide the same for the other host (send and receive) so that you can compare both with each other and discover discrepancies.

Is this good?

http://www.mediafire.com/?27jmk41zl779lh6

Jungletoe

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Re: Sound freezes
« Reply #12 on: April 30, 2013, 01:57:12 am »
Ok, would it be a problem with non-blocking sends if I delete the packet immediately after the send() function? That's the only thing I can think of that could corrupt it.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Sound freezes
« Reply #13 on: April 30, 2013, 04:10:57 am »
Actually I had a look at the pcap file and there are many things that deviate from what would be a "normal" TCP session.

  • Did you capture multiple game sessions within that dump? If not, why are there multiple TCP connections between the 2 hosts? And why are they established in both directions?
  • How do you handle a legitimate disconnect? Is there a "disconnect" packet you send? Or do you just wait for someone to close the connection in order to know that they want to stop playing?
  • This is not your fault, but I reviewed the networking code in SFML yet again, and there is an inherent problem with how it closes TCP connections.

Because TCP sockets are not shutdown() before being close()d, in specific cases (such as yours) a FIN request is sent in one direction and immediately after any incoming traffic arrives a RST packet is sent to indicate that the socket was already close()d although the opposite side still has data to send. This is the opposite of what would be called a "graceful" TCP connection shutdown employing a four-way handshake and is often classified as bad network programming or even a bug in the networking code. I don't know if this is made worse by the fact that the sockets are set to non-blocking because close() is supposed to return immediately, but I can imagine some implementations where it does have noticeable side-effects.

This is probably the biggest problem I have found in the SFML networking code up to now and probably the most annoying one to determine if it really affects you.

I am interested to hear what Laurent has to say to this. For now, you need to think of a way for both sides to agree that the connection is going to be disconnected and stop sending data before closing the SFML Socket object. Any connection termination that occurs without this negotiation would have to be considered as an unexpected termination and proper cleanup has to be performed.

It might seem stupid that you need to replicate features that should be taken care of at lower layers, but engineers are also only humans.

Read more here.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Jungletoe

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Re: Sound freezes
« Reply #14 on: May 01, 2013, 04:18:02 am »
I just realized that I didn't call socket->disconnect() when closing the connection-- I simply just deleted the connector and socket. I'll see if this plays out better.



  • Did you capture multiple game sessions within that dump? If not, why are there multiple TCP connections between the 2 hosts? And why are they established in both directions?
  • How do you handle a legitimate disconnect? Is there a "disconnect" packet you send? Or do you just wait for someone to close the connection in order to know that they want to stop playing?
  • This is not your fault, but I reviewed the networking code in SFML yet again, and there is an inherent problem with how it closes TCP connections.

  • It may have been possible that someone else logged in. And yes, I logged out a few times during that capture session in order to reproduce the errors.
  • It only tests to see if the connection is closed when sending/receiving from the sockets
  • Interesting... would that have to do with my failure to add disconnect() by any chance?
« Last Edit: May 01, 2013, 04:21:55 am by Jungletoe »