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

Author Topic: UDP fragmentation and reassembly  (Read 4806 times)

0 Members and 1 Guest are viewing this topic.

Guni

  • Newbie
  • *
  • Posts: 20
    • View Profile
UDP fragmentation and reassembly
« on: July 01, 2012, 11:09:32 pm »
Hi, I'm using SFML 2.0 release candidate, but I am learning how to use the Network package with the SFML 1.6 tutorial for now.

In this tutorial: http://www.sfml-dev.org/tutorials/1.6/network-packets.php
Quote
The third problem is more network related. Data transfers through TCP and UDP protocols must follow some rules defined by the lower levels of implementation. In particular, a chunk of data can be split and received in several parts ; the receiver must then find a way to recompose the chunk and return data as if it was received in once.
This seems to imply that SFML will handle fragmentation and reassembly of packets if you send too large packets. If you send a large packet with UDP, and it is split up into a number of smaller packets, if even one of those packets fails to send, will the entire message be lost?
« Last Edit: July 01, 2012, 11:14:07 pm by Guni »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: UDP fragmentation and reassembly
« Reply #1 on: July 02, 2012, 08:27:01 am »
This is no longer true in SFML 2.0. UDP datagrams are not split.
Laurent Gomila - SFML developer

Guni

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: UDP fragmentation and reassembly
« Reply #2 on: July 02, 2012, 09:31:09 am »
Well, I believe UDP fragments packets at the IP level, and that if even one of those packets is lost, the whole packet is lost. So I'm guessing if you send a large UDP packet using sf::UdpSocket::send(), it will be fragmented at the IP level. But SFML will not know about this fragmentation, and so it cannot do anything about this fragmentation. sf::UdpSocket is just a somewhat thin layer over using UDP sockets directly. Is this correct or not?
« Last Edit: July 02, 2012, 09:36:46 am by Guni »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: UDP fragmentation and reassembly
« Reply #3 on: July 02, 2012, 09:54:14 am »
Totally correct ;)

sf::UdpSocket doesn't add any robustness on top of the UDP protocol.
Laurent Gomila - SFML developer