SFML community forums

General => General discussions => Topic started by: Laurent on March 23, 2010, 11:07:41 am

Title: Improvement of the network module in SFML 2
Post by: Laurent 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 :)
Title: Improvement of the network module in SFML 2
Post by: eleinvisible 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.
Title: Improvement of the network module in SFML 2
Post by: Laurent 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.
Title: Improvement of the network module in SFML 2
Post by: eleinvisible 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: