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

Author Topic: Improvement of the network module in SFML 2  (Read 3504 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Improvement of the network module in SFML 2
« on: March 23, 2010, 11:07:41 am »
Hi

I've changed a couple of things in the network module in SFML 2. A lot less than I expected, but I inform you anyway so that you don't spend hours to fix the compile errors :)

- sf::SocketTCP and sf::SocketUDP were renamed to sf::TcpSocket and sf::UdpSocket
- The Listen and Accept function were moved from sf::SocketTCP to a new sf::TcpListener class
- sf::IPAddress was renamed to sf::IpAddress
- sf::Selector<T> was changed to a single sf::SocketSelector class that can handle mixed types of sockets
- I added function to retrieve the local and remote port/address of a socket
- Important: socket classes have now entity semantics, they are not copyable anymore and close themselves automatically when they are destructed
- I updated the API documentation of the whole module

I have changed a lot of code, so some new bugs may appear :)
Laurent Gomila - SFML developer

eleinvisible

  • Newbie
  • *
  • Posts: 47
    • View Profile
Improvement of the network module in SFML 2
« Reply #1 on: March 23, 2010, 09:53:11 pm »
"- Important: socket classes ... close themselves automatically when they are destructed"

If I understand correctly, the close() function is no longer public? I guess I'll have to check the docs to see how it works now, but this seems odd to me. Otherwise, great changes.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Improvement of the network module in SFML 2
« Reply #2 on: March 24, 2010, 08:18:53 am »
Quote
If I understand correctly, the close() function is no longer public? I guess I'll have to check the docs to see how it works now, but this seems odd to me

Why "odd"? You can now Disconnect() a TcpSocket, and you can still Unbind() a UdpSocket.
Laurent Gomila - SFML developer

eleinvisible

  • Newbie
  • *
  • Posts: 47
    • View Profile
Improvement of the network module in SFML 2
« Reply #3 on: March 25, 2010, 05:22:19 pm »
Ah, didn't see those. That makes much more sense, I thought you had removed all the re-use of a socket. Sorry  :oops:

 

anything