Latest release of licensed socket server code: 6.0
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\VC6Compatibilitydirectory withsal.hfor VS.Net (2002) and VS 2003. The directory is now calledAdmin\Compatibilityand you need to copysal.hto your compiler’s include directory if it complains about it being missing. -
Some more changes with how
Admin.hworks.Admin.hnow requires that a file calledConfig.hexists in theAdmindirectory.Config.his used to store all of your library settings.Admin.hnow simply includesTargetWindowsVersion.handConfig.hand 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 exampleConfig.hfiles in theAdmin\ExampleConfigHeaderssubdirectory. Simply copy one into theAdmindirectory, rename it toConfig.hand edit it as you wish. Likewise there are examples ofTargetWindowsVersion.hfiles and again you need to copy one into theAdmindirectory and rename it before your first build. -
Added
Admin\DetectPlatformSDKVersion.hwhich can be included in yourAdmin\Config.hfile 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 includesdkddkver.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.hnow 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 inAdmin.cppand the short version to provide compiler specific directory names in test code. -
Some changes in
SecureCRT.h, compilers earlier than VS2005 now use_snsprintfforsprintf_sand we supportswprintf_sas_snwprintf. -
Warnings.hnow suppresses warning 4686 when building with STLPort. -
Bug fix in
Admin\WinsockWrapper.hfor compilers earlier than VS2005 compiling with Windows SDK v6.1; we now useJETBYTE_MESSAGEto output the warning message. -
Removed
Admin\MsCoreE.hwhich was only required for VC6. You should now includemscoree.hdirectly.
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::Win32namespace. -
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::CSharedCriticalSectionin previous releases of the library is now inJetByteTools::Win32::CSharedCriticalSectionFactoryas this more accurately describes what the class is.JetByteTools::Win32::CSharedCriticalSectionnow provides functionality for a critical section that is provided by one of the critical section factorys. -
Added the
JetByteTools::Win32::ISharedCriticalSectioninterface which allows you to access the underlyingJetByteTools::Win32::ICriticalSectioninterface and requires that you callJetByteTools::Win32::ISharedCriticalSection::Release()when you no longer need to use the shared lock. -
Added
JetByteTools::Win32::CSmartSharedCriticalSectionwhich provides an RAII wrapperfor JetByteTools::Win32::ISharedCriticalSectioninstances. -
Breaking Change to
JetByteTools::Win32::ICriticalSectionFactory, it now returns instances ofJetByteTools::Win32::ISharedCriticalSectionrather thanJetByteTools::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::CUniqueCriticalSectionFactorywhich creates a unique instance of a critical section for each request and destroys the instance whenJetByteTools::Win32::ISharedCriticalSection::Release()is called on it. This allows you to replace an instance ofJetByteTools::Win32::CSharedCriticalSectionFactorywith 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 inUtils.h. These have all been moved intoToString.h, thoughUtils.hstill provides access. We have also changed how we convert numeric types to strings. Prior to this release we usedstd::strstreamand 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 customsprintfbased system to convert from numbers to strings. We also decided to change how 0 is represented inJetByteTools::Win32::ToHexString(), it’s converted to0x0in the new code whereas it was converted to0in 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 addedJetByteTools::Win32::PointerToString()which gives a consistent represenation of pointers across 32bit and 64bit operating systems (always representing pointers as 64bit hex values). If you defineJETBYTE_USE_TEMPLATE_TO_STRINGas1in yourAdmin\Config.hfile then you will revert to the pre version 6.0 behaviour and functionality usingstd::strstream. Please note that this old code is likely to be deprecated in a future release and then removed. -
JetByteTools::Win32::CTimeChangeNotificationMonitornow compiles on versions of the compiler with headers that don’t include a definition ofUSER_TIMER_MAXIMUM. -
Added
/Zm200to 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 ofsprintf_sthat 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()andJetByteTools::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::CRotatingAsyncFileLogcan 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 asJetByteTools::Socket::CSmartBufferbut it should have always been in the IO namespace. -
Added
JetByteTools::IO::SplitBufferFromBack(), this is a more efficient way of splitting a buffer than callingJetByteTools::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 howJetByteTools::IO::IBuffer::SplitBufferFromFront()works. -
Breaking Change Renamed
JetByteTools::IO::IBuffer::SplitBuffer()toJetByteTools::IO::IBuffer::SplitBufferFromFront(). In most cases it would probably be better to useJetByteTools::IO::SplitBufferFromBack()rather thanJetByteTools::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::ICriticalSectionFactorychanges. -
Moved
JetByteTools::Socket::IFilterableStreamSocket::GetLock()toJetByteTools::Socket::IStreamSocket -
JetByteTools::Socket::CSocketAllocatorandJetByteTools::Socket::TSocketAllocatornow take a pointer to an optional instance ofJetByteTools::Win32::ICriticalSectionFactory. If this instance is non null then the version ofJetByteTools::Socket::CSocketAllocator::CreateSocket()that takes an instance ofJetByteTools::Win32::ISharedCriticalSectionis used for socket creation. If no lock factory is supplied then the version ofJetByteTools::Socket::CSocketAllocator::CreateSocket()that only takes the number of user data slots required is used. Derived classes must provide implementations of both versions ofCreateSocket()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 theJetByteTools::Socket::CSocketAllocatorbase class or that one never is. Derived classes can use the new version of theCreateSocket()method to provide sockets that have their own unique lock and which can not ever share locks. -
JetByteTools::Socket::CStreamSocketandJetByteTools::Socket::TAsyncSocketnow take an instance ofJetByteTools::Win32::ICriticalSectionrather than an instance ofJetByteTools::Win32::ICriticalSectionFactoryin their constructors. -
Added two new versions of all socket classes; e.g.
JetByteTools::Socket::CUniqueLockStreamSocketandJetByteTools::Socket::CSharedLockStreamSocket. These are now the concrete socket classes which are allocated by the allocators. The unique lock versions have an instance of aJetByteTools::Win32::CCriticalSectioninside them, the shared lock versions use aJetByteTools::Win32::CSmartSharedCriticalSectionto manage their shared lock. This allows allocators to allocate either using a lock factory or using unique locks. Note that not usingJetByteTools::Win32::CUniqueCriticalSectionFactoryto provide unique (but conceptually shared) locks gives a space advantage as shared locks are larger than non shared locks. However,JetByteTools::Win32::CUniqueCriticalSectionFactoryCAN be used to swap the lock allocation policy at run time rather than compile time… -
Bug fix in
SocketTools\WinsockWrapper.hfor compilers earlier than VS2005 compiling with Platform SDK 6.1; we now useJETBYTE_MESSAGEto output the warning message. -
Bug fix and subsequent changes to various
JetByteTools::Socket::CSocketmethods 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]:portstyle address strings. This will have had a knock on effect withJetByteTools::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::CSmartBufferto the IOTools library, the header is now in the IOTools library and the class is nowJetByteTools::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
spinCountwhich is used to initialise the critical sections used by the sockets that it creates. -
Changes to how
JetByteTools::Socket::CFlowControlStreamSocketConnectionFilterworks. All of the policy decisions regarding what to do when the buffer list fills up has now been passed on to an instance of theJetByteTools::Socket::CFlowControlStreamSocketConnectionFilter::IProcessBufferListinterface, so you always need to supply one of these now. There’s a new classJetByteTools::Socket::CFlowControlListProcessorwhich 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::CFlowControlStreamSocketConnectionFilteralso handles write completion errors now, it used to pretend to but didn’t.JetByteTools::Socket::IMonitorStreamSocketFlowControlhas 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 eithertrueorfalsedepending 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
OutputDebugStringcalls fromJetByteTools::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::CExceptionwhich we now use in place ofJetByteTools::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.hdirectly 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.