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

Author Topic: [PROBLEM] Expression is_block_type_valid(header->_block_use)  (Read 5594 times)

0 Members and 1 Guest are viewing this topic.

morsisko

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
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.

Gambit

  • Sr. Member
  • ****
  • Posts: 283
    • View Profile
Re: [PROBLEM] Expression is_block_type_valid(header->_block_use)
« Reply #1 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.

morsisko

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: [PROBLEM] Expression is_block_type_valid(header->_block_use)
« Reply #2 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.

morsisko

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: [PROBLEM] Expression is_block_type_valid(header->_block_use)
« Reply #3 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.