C++ Socket library tutorial
|
|
New in 2.0: interface changes
With version 2.0, a few classes has been removed and some methods have been moved.
The old style ssl support has been removed, including the classes SSLSocket, HttpsSocket and
HttpsGetSocket.
To convert an old style socket implementing the SSLSocket, please follow these steps.
- Inherit TcpSocket instead of SSLSocket
- Rename the method OnSSLInitDone to OnConnect
- Rename the methods InitAsServer and InitAsClient to
InitSSLServer and InitSSLClient respectively
- Call EnableSSL() in the constructor* so ssl is enabled
*) On incoming connections that need to look at the port number to determine what protocol to use,
EnableSSL() must be placed in the Init() method. Use GetParent() -> GetPort() to get the
port number that the connection was accepted on.
All address resolution/conversion methods have been moved from the Socket class
to the class Utility and been made static. Here's a table to help converting.
Old class and name | New class and name |
Socket::isip | Utility::isipv4 Utility::isipv6 |
Socket::u2ip | Utility::u2ip |
Socket::l2ip | Utility::l2ip |
2.0.2: All address resolution/conversion methods have been moved from the SocketHandler class
to the class Utility and been made static. Here's a table to help converting.
Old class and name | New class and name |
SocketHandler::in6_addr_compare | Utility::in6_addr_compare |
SocketHandler::ResolveLocal | Utility::ResolveLocal |
SocketHandler::GetLocalHostname | Utility::GetLocalHostname |
SocketHandler::GetLocalIP | Utility::GetLocalIP |
SocketHandler::GetLocalAddress | Utility::GetLocalAddress |
SocketHandler::GetLocalIP6 | Utility::GetLocalIP6 |
SocketHandler::GetLocalAddress6 | Utility::GetLocalAddress6 |
|