SFML community forums

Help => Network => Topic started by: morsisko on June 24, 2016, 08:22:02 pm

Title: [PROBLEM] Expression is_block_type_valid(header->_block_use)
Post by: morsisko on June 24, 2016, 08:22:02 pm
Hi!
I have a strange problem with the network module in SFML(TCP sockets).
What's going on?
When i set my nickname on text longer than 5 chars there is happening something magic
There are video about this:
http://puu.sh/pEC6r/48d76216b9.mp4
So simply if my nickname is shorter than 5 chars it works great, but when it's equal or longer that 5 chars it starting crashing.

There are source codes:
Server: http://pastebin.com/2Dzs1qbj
Client: http://pastebin.com/tEFa7QSV

I think that the problem is in the client (because it's crashing) but i can't understand why. Yes, I tried debugging it, but it works great since it reach the line 107 after recv packet, and there I jump into one of C++ read-only file.

Thanks for help.
Title: Re: [PROBLEM] Expression is_block_type_valid(header->_block_use)
Post by: Gambit on June 24, 2016, 08:34:08 pm
For starters I can see a lot of memory leaks happening in your code. If you have access to smart pointers (A compiler that can compiler C++11/+code), use them.

Aside from that, you never remove ClientCommunications for clients that have disconnected.
Title: Re: [PROBLEM] Expression is_block_type_valid(header->_block_use)
Post by: morsisko on June 24, 2016, 09:30:56 pm
Hey, thanks for answer.

At the moment i don't care about memory leaks, because it's only test app, i just started testing it and saw that something is wrong, so i focused on the problem, later i will of course clean the code, I will remove ClientCommunications, but I think that it won't help in this case.
Title: Re: [PROBLEM] Expression is_block_type_valid(header->_block_use)
Post by: morsisko on June 28, 2016, 09:50:51 pm
I solved that issue. I was using v140 toolset instead of v120(in msvc). Now it works fine.