Latest release of licensed socket server code: 6.0

| 0 Comments

The latest release of The Server Framework is now available. This release includes the following changes.

The following changes were made to the libraries.

Admin Library - 6.0

  • Added back the Admin\VC6Compatibility directory with sal.h for VS.Net (2002) and VS 2003. The directory is now called Admin\Compatibility and you need to copy sal.h to your compiler's include directory if it complains about it being missing.
  • Some more changes with how Admin.h works. Admin.h now requires that a file called Config.h exists in the Admin directory. Config.h is used to store all of your library settings. Admin.h now simply includes TargetWindowsVersion.h and Config.h and validates that all the settings are acceptable. We're doing it this way so that you actually have to think about what settings you want to build with when you first install the code rather than simply taking our current defaults. Also this makes it considerably easier for us to run automated builds with different settings, and to adjust settings without continually checking them in to source control by mistake. There are some example Config.h files in the Admin\ExampleConfigHeaders subdirectory. Simply copy one into the Admin directory, rename it to Config.h and edit it as you wish. Likewise there are examples of TargetWindowsVersion.h files and again you need to copy one into the Admin directory and rename it before your first build.
  • Added Admin\DetectPlatformSDKVersion.h which can be included in your Admin\Config.h file to automatically set the correct defines for the version of the Platform SDK that you have installed. Note that it only works with the latest versions of the Platform SDK that include sdkddkver.h.
  • We don't support Visual Studio .Net (2002) without a separate Windows SDK installed. There are issues with the headers that ship with this compiler which means that it can't compile for Win2k without a Windows SDK. We support all other compilers without the use of the Windows SDKs if the compiler itself supports the required platform. If in doubt, install the latest Windows SDK; there's really no reason not to.
  • We don't support x64 builds on compilers prior to Visual Studio 2005. In truth we never did but Admin.h now raises an error if you try.
  • New header, CompilerName.h, which gives you a textual representation of the value of _MSC_VER. We use the long version of these in Admin.cpp and the short version to provide compiler specific directory names in test code.
  • Some changes in SecureCRT.h, compilers earlier than VS2005 now use _snsprintf for sprintf_s and we support swprintf_s as _snwprintf.
  • Warnings.h now suppresses warning 4686 when building with STLPort.
  • Bug fix in Admin\WinsockWrapper.h for compilers earlier than VS2005 compiling with Windows SDK v6.1; we now use JETBYTE_MESSAGE to output the warning message.
  • Removed Admin\MsCoreE.h which was only required for VC6. You should now include mscoree.h directly.
C++ Tools Library - 6.0
  • This library no longer exists, it has been merged with the Win32 Tools library.
Win32 Tools Library - 6.0
  • The C++Tools and RegistryTools libraries have been merged with this library. All code that used to be in these libraries and their associated namespaces are now in the JetByteTools::Win32 namespace.
  • Breaking Changes to how we share a pool of critical sections; see below and see here: http://www.lenholgate.com/archives/000825.html for more details.
    • Breaking Change. The functionality that was in JetByteTools::Win32::CSharedCriticalSection in previous releases of the library is now in JetByteTools::Win32::CSharedCriticalSectionFactory as this more accurately describes what the class is. JetByteTools::Win32::CSharedCriticalSection now provides functionality for a critical section that is provided by one of the critical section factorys.
    • Added the JetByteTools::Win32::ISharedCriticalSection interface which allows you to access the underlying JetByteTools::Win32::ICriticalSection interface and requires that you call JetByteTools::Win32::ISharedCriticalSection::Release() when you no longer need to use the shared lock.
    • Added JetByteTools::Win32::CSmartSharedCriticalSection which provides an RAII wrapper for JetByteTools::Win32::ISharedCriticalSection instances.
    • Breaking Change to JetByteTools::Win32::ICriticalSectionFactory, it now returns instances of JetByteTools::Win32::ISharedCriticalSection rather than JetByteTools::Win32::ICriticalSection. It also supports 'pools' of shared locks and the ability to request a shared lock from a specific pool.
    • Added a new critical section factory, JetByteTools::Win32::CUniqueCriticalSectionFactory which creates a unique instance of a critical section for each request and destroys the instance when JetByteTools::Win32::ISharedCriticalSection::Release() is called on it. This allows you to replace an instance of JetByteTools::Win32::CSharedCriticalSectionFactory with an instance of this factory to give each user of the factory its own unique critical sections. This can be useful if you find that no matter what the size of the pool the contention between users for the same, shared, lock is too great.
  • Added support for JetByteTools::Win32::ICriticalSection::TryEnter().
  • Breaking Change to the JetByteTools::Win32::ToString() functions in Utils.h. These have all been moved into ToString.h, though Utils.h still provides access. We have also changed how we convert numeric types to strings. Prior to this release we used std::strstream and templates and streamed the type into a string. However this requires the acquisition of a process wide lock (for accessing locales and facets) in some versions of STL which is less than ideal for multi-threaded use. From this release we default to using a custom sprintf based system to convert from numbers to strings. We also decided to change how 0 is represented in JetByteTools::Win32::ToHexString(), it's converted to 0x0 in the new code whereas it was converted to 0 in the old. JetByteTools::Win32::ToHexString() was also enhanced to allow for the user to decide if they want upper or lower case hex digits and we added JetByteTools::Win32::PointerToString() which gives a consistent represenation of pointers across 32bit and 64bit operating systems (always representing pointers as 64bit hex values). If you define JETBYTE_USE_TEMPLATE_TO_STRING as 1 in your Admin\Config.h file then you will revert to the pre version 6.0 behaviour and functionality using std::strstream. Please note that this old code is likely to be deprecated in a future release and then removed.
  • JetByteTools::Win32::CTimeChangeNotificationMonitor now compiles on versions of the compiler with headers that don't include a definition of USER_TIMER_MAXIMUM.
  • Added /Zm200 to the Visual Studio .Net (2002) project file as it seems to need more space for precompiled headers when compiling with STLPort. Note that you can remove this if you do not need STLPort support
I/O Tools Library - 6.0
  • Changes due to the merging of C++Tools and RegistryTools with Win32Tools.
  • JetByteTools::IO::CAsyncFileLog::LogMessage() now uses the version of sprintf_s that takes the length of the destination buffer.
  • Added JetByteTools::IO::CAsyncFileWriter::GetFileNameIfKnown() which returns the name of the file being written to if it's known; note that at present we do not attempt to find out the name of file handles which are passed to us so we only return the file name if the file name was passed to us in the constructor.
  • Added JetByteTools::IO::CAsyncFileWriter::GetFileSize() which returns the current size of the file being written to.
  • Added JetByteTools::IO::CRotatingAsyncFileLog::GetCurrentLogFileName() which returns the full name of the current log. This is useful as otherwise it's non-trivial to work out the name of a log that may include time and date details.
  • Changes to JetByteTools::IO::IMonitorBufferAllocation::OnBufferAllocated() and JetByteTools::IO::IMonitorBufferAllocation::OnBufferReleased(), they both now get passed the buffer's user data so that they can be used to add or remove user data from buffers.
  • JetByteTools::IO::CRotatingAsyncFileLog can now be configured to delete empty log files when a new log file is created. This means that only the log files that contain logged messages are kept.
  • Added JetByteTools::IO::CSmartBuffer, this was previously available as JetByteTools::Socket::CSmartBuffer but it should have always been in the IO namespace.
  • Added JetByteTools::IO::SplitBufferFromBack(), this is a more efficient way of splitting a buffer than calling JetByteTools::IO::IBuffer::SplitBufferFromFront() as it results in less memory copying; however it returns the data that was removed from the current buffer and leaves the current buffer with the remaining data in it which is the opposite to how JetByteTools::IO::IBuffer::SplitBufferFromFront() works.
  • Breaking Change Renamed JetByteTools::IO::IBuffer::SplitBuffer() to JetByteTools::IO::IBuffer::SplitBufferFromFront(). In most cases it would probably be better to use JetByteTools::IO::SplitBufferFromBack() rather than JetByteTools::IO::IBuffer::SplitBufferFromFront() but this requires code changes.
Socket Tools Library - 6.0
  • Changes due to the merging of C++Tools and RegistryTools with Win32Tools.
  • Changes to how we share critical sections amongst sockets to take advantage of the JetByteTools::Win32::ICriticalSectionFactory changes.
    • Moved JetByteTools::Socket::IFilterableStreamSocket::GetLock() to JetByteTools::Socket::IStreamSocket
    • JetByteTools::Socket::CSocketAllocator and JetByteTools::Socket::TSocketAllocator now take a pointer to an optional instance of JetByteTools::Win32::ICriticalSectionFactory. If this instance is non null then the version of JetByteTools::Socket::CSocketAllocator::CreateSocket() that takes an instance of JetByteTools::Win32::ISharedCriticalSection is used for socket creation. If no lock factory is supplied then the version of JetByteTools::Socket::CSocketAllocator::CreateSocket() that only takes the number of user data slots required is used. Derived classes must provide implementations of both versions of CreateSocket() but can fail one or the other if they wish as long as their constructors ensure that either a lock factory is always passed through to the JetByteTools::Socket::CSocketAllocator base class or that one never is. Derived classes can use the new version of the CreateSocket() method to provide sockets that have their own unique lock and which can not ever share locks.
    • JetByteTools::Socket::CStreamSocket and JetByteTools::Socket::TAsyncSocket now take an instance of JetByteTools::Win32::ICriticalSection rather than an instance of JetByteTools::Win32::ICriticalSectionFactory in their constructors.
    • Added two new versions of all socket classes; e.g. JetByteTools::Socket::CUniqueLockStreamSocket and JetByteTools::Socket::CSharedLockStreamSocket. These are now the concrete socket classes which are allocated by the allocators. The unique lock versions have an instance of a JetByteTools::Win32::CCriticalSection inside them, the shared lock versions use a JetByteTools::Win32::CSmartSharedCriticalSection to manage their shared lock. This allows allocators to allocate either using a lock factory or using unique locks. Note that not using JetByteTools::Win32::CUniqueCriticalSectionFactory to provide unique (but conceptually shared) locks gives a space advantage as shared locks are larger than non shared locks. However, JetByteTools::Win32::CUniqueCriticalSectionFactory CAN be used to swap the lock allocation policy at run time rather than compile time...
  • Bug fix in SocketTools\WinsockWrapper.h for compilers earlier than VS2005 compiling with Platform SDK 6.1; we now use JETBYTE_MESSAGE to output the warning message.
  • Bug fix and subsequent changes to various JetByteTools::Socket::CSocket methods so that we report the correct 'last error' when errors occur.
  • Bug fix in JetByteTools::Socket::CAddressIPv6, we were failing to parse IPv6 address strings correctly, we now correctly parse [ffff:ffff:ffff:ffff:ffff]:port style address strings. This will have had a knock on effect with JetByteTools::Socket::CFullAddress also failing to parse these address strings correctly.
  • JetByteTools::Socket::IAsyncSocket::TryRead() is no longer 'nothrow' as it CAN thrown an exception if the buffer that it is supplied has no space left in it.
  • Breaking Change Moved JetByteTools::Socket::CSmartBuffer to the IOTools library, the header is now in the IOTools library and the class is now JetByteTools::IO::CSmartBuffer.
  • Breaking Change JetByteTools::Socket::CFlowControlStreamSocketConnectionFilter::IProcessBufferList::OnListFull() now takes a socket reference. This allows you to close the connection if you need to.
  • Added JetByteTools::Socket::CSocket::TryBind() which attempts to bind and returns an error code on failure.
  • All socket allocators that do not require a lock factory now take an optional spinCount which is used to initialise the critical sections used by the sockets that it creates.
  • Changes to how JetByteTools::Socket::CFlowControlStreamSocketConnectionFilter works. All of the policy decisions regarding what to do when the buffer list fills up has now been passed on to an instance of the JetByteTools::Socket::CFlowControlStreamSocketConnectionFilter::IProcessBufferList interface, so you always need to supply one of these now. There's a new class JetByteTools::Socket::CFlowControlListProcessor which provides the old functionality of 'throw away earliest', and 'throw away latest' and also includes the option to abort the connection if too much data is being buffered. JetByteTools::Socket::CFlowControlStreamSocketConnectionFilter also handles write completion errors now, it used to pretend to but didn't. JetByteTools::Socket::IMonitorStreamSocketFlowControl has a new function which is called when a write completion error occurs and you can do something about it, if you can(!) and then return either true or false depending on if you want the failure to cause more data to be sent from the queued data or not.
OpenSSL Tools Library - 6.0
  • Removed some OutputDebugString calls from JetByteTools::OpenSSL::CAsyncConnector.
SChannel Tools Library - 6.0
  • No changes.
PerfMon Tools Library - 6.0
  • No changes.
Service Tools Library - 6.0
  • You can now provide the name of an event that you require to be signalled when the service has stopped. This is mainly used by our example services so that their test harnesses can monitor them correctly.
CLRHosting Tools Library - 6.0
  • Added JetByteTools::CLRHosting::CException which we now use in place of JetByteTools::COM::CException. This exception class tries quite hard to get meaningful error description strings from the CLR dlls; it doesn't always work though :(.
  • We now include mscoree.h directly rather than including the Admin library wrapper. The wrapper was only required for VC6 and has now been removed.

Full details of the licensed version of the code are available here.

Full details of the free version of the code are available here.

Doxygen documentation for the latest release is available here.

If you're an existing client and you'd like these changes let me know.

Leave a comment