Home  +  Forums  +  C++ and Sockets  +  C++ and SQL: MySQL, sqlite, ODBC  +  Miscellaneous Projects
Logo
~Sockets~
~New~
~Examples~
~Contact~

C++ Socket library tutorial

New in 2.0: interface changes

Prev   |   Menu   |   Next

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 nameNew class and name
Socket::isipUtility::isipv4
Utility::isipv6
Socket::u2ipUtility::u2ip
Socket::l2ipUtility::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 nameNew class and name
SocketHandler::in6_addr_compareUtility::in6_addr_compare
SocketHandler::ResolveLocalUtility::ResolveLocal
SocketHandler::GetLocalHostnameUtility::GetLocalHostname
SocketHandler::GetLocalIPUtility::GetLocalIP
SocketHandler::GetLocalAddressUtility::GetLocalAddress
SocketHandler::GetLocalIP6Utility::GetLocalIP6
SocketHandler::GetLocalAddress6Utility::GetLocalAddress6

Prev   |   Menu   |   Next

Valid HTML 4.01!

Validate
Page, code, and content Copyright (C) 2021 by Anders Hedström