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

Author Topic: Dont get all data - UDP and TCP  (Read 3547 times)

0 Members and 1 Guest are viewing this topic.

raXor

  • Newbie
  • *
  • Posts: 7
    • View Profile
Dont get all data - UDP and TCP
« on: December 11, 2009, 07:24:43 pm »
Hi, I have a big problem in a network program.
I have written a simple chat. The problem is that I dont receive all data. I get only the first 4 characters of the sending string.

I have testet all possibilites with different sockets (UDP/TCP), threads etc.
Heres my actually Code (in UDP):
http://codepaste.net/tyokzh

The hole project is here:
http://www.uwe-collmer.de/Netzwerk.rar

I hope someone can help me...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Dont get all data - UDP and TCP
« Reply #1 on: December 11, 2009, 07:48:07 pm »
Hi

sizeof(sText.c_str()) gives you the size in memory of a const char*, which is 4 bytes on your machine. What you want is sText.size().
Laurent Gomila - SFML developer

raXor

  • Newbie
  • *
  • Posts: 7
    • View Profile
Dont get all data - UDP and TCP
« Reply #2 on: December 11, 2009, 11:25:52 pm »
Oh... damn mistake.

Thank you very much Laurent!

 

anything