Skip to content | Change text size

About SocketCC

SocketCC is a class library that encapsulates the existing Sockets API which is available on all Linux/UNIX environments and provides a simple solution to writing networked IP applications in these environments. As an advantage, the class structure supports both the TCP and UDP Protocols as well as development of IPv4 and IPv6 capable applications.

SocketCC was originally developed for my personal needs - I was developing an IPv4/IPv6 Streaming Traffic Generator - following development of the SocketCC library, it was decided that it could be used as the base of not only future development efforts within the Department, but also for any student network projects. At this stage an article about SocketCC was written and published in Dr. Dobbs Journal - read the article.

The SocketCC library and associated documentation can be downloaded here. SocketCC is released under a form of open license, for futher details see below:

Usage License

SocketCC has been released for public use including in commericial applications. Please note any restrictions on this license below.

  • The code remains the copyright of Monash University, the copyright message and other ownership comments within the source code cannot be removed.
  • You may freely modify SocketCC for your own purposes, however any modifications must maintain the original copyright messages. Furthermore, this modified code cannot be made available to others. If you wish to make the changes publicaly available, consider making a contribution to SocketCC.
  • Neither Monash University or I (Jason But) guarantee the suitability of the SocketCC library for any purpose whatsoever. This code is provided in the spirit of open programming. The onus is on you to determine if the library is suitable for the application you are developing.
  • Support for the SocketCC library is not guaranteed, while I will endeavour to fix any bugs within the library, modifications and extensions will be based on my requirements. However, please feel free to make contributions to the library. These will be reviewed before being added to the official release.

Version Information

Version 1.38 - Release Date (April 11 2003)

I know I have correponded with some people and promised this release some time ago. In fact, I was going to release it twice and each time before the actual release I got further suggestions for changes. Finally, happy with all the changes, here it is, though somewhat late. This version is well worth the effort to download, some implementation changes means more efficiency plus there is also extra functionality.

  • Added support for FreeBSD, many thanks to Clayborne D. Taylor. Platforms now supported include Linux, Solaris, MacOS X.1, MacOS X Jaguar and FreeBSD.

  • Added sample code for a multi-threaded TCP Server Deamon.

  • Send Data methods on all socket classes now take const parameters to refer to the data being sent, this is more correct as the sent data is never modified.

  • Many thanks to Andrea Rui for pointing out that accepting a connection on a TCPServerSocket wastes resources as a temporary socket is created and then closed before the pending connection is assigned to the new socket. I modified Andrea's approach to produce a more streamlined result. This problem has now been fixed, temporary socket descriptors are not allocated or created, also it is now far easier to accept a connection to varying types of different socket classes - this doesn't make sense on any class other than TCPSocket in the library but a programmer may want to create a new class called SSLSocket for example. Unfortunately this fix has changed the interface to the Accept() method in SocketBase, this should have no effect on existing code that uses the inherited classes, but any code that directly uses SocketBase may need to be changed.

  • A side effect of the above change is that it is now possible to create instances of SocketCC socket classes SocketBase, TCPSocket and UDPSocket from a socket descriptor. Note that these descriptors are not checked to ensure they refer to a valid socket or a socket of the correct type. They are primarily left public to allow piecemeal upgrade of existing software to support SocketCC without having to change the entire code base.

  • New class SocketSet added to library to allow better use of library with the select() and pselect() function calls. This class allows construction of an fd_set analogue which can then be passed to these function calls. The class instance can then be queried to see which sockets were selected.

Version 1.30 - Release Date (November 14th 2002)

  • Added support for Apple MacOS X Original Release and Apple MacOS X Jaguar. Many thanks to Desmond Schmidt and Daniel Grimm.

  • Enhanced functionality of TCPSocket::SendASCII() and TCPSocket::RecvASCII() to allow specification of the string terminating character. For backwards compatibility, this has a default value of '\0'.

  • Enhanced functionality of send and receive methods in all TCP and UDP socket classes to allow specification of socket flags. A default value of zero allows backwards compatibility.

  • Added new method to IPAddress to return an unmapped (not IPv6 Mapped IPv4) string representation of the IP Address.

  • Fixed minor bug in not releasing allocated memory.

  • Installation directory changed.

  • Error number for errUnknown exceptions NOW printed correcly.

Version 1.20 - Release Date (September 12th 2002)

  • Fixed lazy evaluation bug, bStrAddressUnresolved and pcStrAddress incorrectly set when copying from an IPAddress instance where this string has yet to be evaluated.
  • New exception type - errHostUnreachable - added.
  • All errUnknown exceptions now include value of errno.
  • pcHostName replaced with strHostName of type std::string. This should fix a range of minor memory leakage problems as well as simplify the code.
  • Fixed bug with a non-blocking TCPServerSocket, each no pending connections situation was not releasing socket descriptors and resources allocated in the AcceptClient() method.
  • Added new methods to TCPSocket to send and receive different types of data (uint16_t, uint32_t, C-style strings).
  • UDPServerSocket constructor no longer requires the IPv6 flag when binding to a specific IP address, but is still required when binding to a wildcard address.

Version 1.11

  • Added support for Solaris platform, many thanks to Andreas Almroth for his contribution
  • Fixed minor bugs which did not show up on Linux compile but did on Solaris compile. These just ensure that all structures are properly initialised before function calls (Linux didn't seem to care for certain function calls)
  • Incorporated both makefiles into a single Makefile. New Makefile offers basic multi-platform support and a basic structure to enable support of further platforms in the source code
  • Fixed "Hiding of Local Variables" Bug in TCPServerSocket

Version 1.10

  • SocketCC now uses PThreadCC to implement thread-safe code, requires installation of PThreadCC
  • Fixed implementation of IPAddress class, now performs lazy evaluation of reverse-DNS lookup, improving execution times greatly
  • Improved thread-safe implementation of SocketBase, only one thread can execute a method on a given socket at a given time. If the socket connection is closed, any other threads blocked on that socket will fail with an exception. This allows an Accept() call on a listening socket to run in a seperate thread, when the listening socket is closed, all threads blocked on Accept() will unblock
  • Fixed minor bugs and improved some implementation algorithms
  • Improved commenting

Version 1.00

Using IPv4 on an IPv6 enabled website