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

Author Topic: tcpsocket send function 3rd argument  (Read 2093 times)

0 Members and 2 Guests are viewing this topic.

lorence30

  • Full Member
  • ***
  • Posts: 124
    • View Profile
    • Email
tcpsocket send function 3rd argument
« on: November 01, 2015, 12:08:20 am »
I noticed the documentation of sf::TcpSocket in SFML 2.3.1, theres a
send (const void *data, std::size_t size, std::size_t &sent) function, tcpsocket guarantees all data it send will be sent successfully, so whats the sense of the 3rd parameter of this function?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: tcpsocket send function 3rd argument
« Reply #1 on: November 01, 2015, 01:18:56 am »
TCP guarantees that all data that is sent will arrive and in order without duplicates. However, if you try to send too much data all at once the OS won't be able to buffer all of it and will tell you to try to send it again - hence the 3rd parameter that tells you how much was actually sent.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor