Search code examples
windowswxwidgetsmingw-w64

What is the difference between wxSocketServer and wxTcpServer?


I am using wxWidgets 3.0.2 with mingw-w64 (g++) and would like to write a server that listens on a TCP port and can maintain multiple connections from clients simultaneously.

There is documentation along with one official code sample for wxSocketServer. There is also a class called wxTCPServer which has bare-bones documentation.

However I have been unable to find (by googling) any code samples or explanation relating to wxTCPServer. What is the difference between the two and which one should I use?


Solution

  • wxTCPServer is a TCP-based implementation of the wxWidgets IPC protocol (the other implementation, available only under MSW, uses DDE). Normally you should not use it directly but use wxServer instead. Of course, if you need a generic socket server, you should use wxSocketServer itself and not either of these classes.

    Better yet, use a dedicated socket/network library such as (Boost) ASIO or cpp-netlib. wxWidgets TCP support is very basic and should be only used for relatively simple things, i.e. when neither performance nor scalability matter.