An Asynchronous Socket Server and Client
I've been working with sockets since 2000, using Delphi 5.0 and some third-party libraries (Synapse). My very first socket application just copied files between many clients and one server. The client app checks a folder to see if files exist, asks the server where to copy the files in the network and, after copying the files, flags the database record indicating that a file has been moved. The server listens to the client connections, and both exchange XML messages indicating the state of each file copy. Synapse is a blocking socket implementation, and I needed a thread pooling mechanism that works like an HTTP server, because I couldn't keep the connection open (one thread per connection). My solution was to use some IOCP functions to pool the client requests (code) and close the connection after the message exchange was terminated.
Now, using C#, I decided to write a socket server and client library that helps me to only have to think about the message exchange (the process) and let .NET do the hard job. So, I needed the following features:
Some encryption and compression capabilities
Encapsulate the socket, and encrypt the services in the interfaces and separate them from the host implementation
frmClient.cs frmClient.Designer.cs Program.cs AssemblyInfo.cs Main.cs ChatCryptService.cs ChatServiceServer.cs ChatServiceServer.Designer.cs ChatServiceServerInstaller.cs ChatServiceServerInstaller.Designer.cs