SkillAgentSearch skills...

WinSocket

TLS Examples in Schannel and IO Completion Ports

Install / Use

/learn @coin8086/WinSocket
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

TLS Examples in Schannel and IO Completion Ports

Before You Run

You need a certificate for the server. The Subject Name of the certificate must be "localhost", and the certificate must be stored in the "My" store of the system's certificate store, in the "Local Machine". The certificate can be self issued but must not be expired.

Simple Server and Client

Start echo server and write what received to stdout, which is redirected to file svr-output since client may send binary data.

SimpleSocketServer.exe -t 1>svr-output

Start client to send file-to-send to server, and write what server sent back to stdout, which is redirected to file cli-output.

SimpleSocketClient.exe localhost -t 1>cli-output <file-to-send

In the end, svr-output, cli-output and file-to-send should be identical.

When option -t is present on command line, TLS is enabled on socket. Remove the option to send and receive without TLS.

IOCP Server

Start iocp server with TLS by

IocpServer.exe -t

or without TLS

IocpServer.exe

Then you can use the simple client to interact with it as mentioned above, like

SimpleSocketClient.exe localhost -t 1>cli-output <file-to-send

You can also try to script multiple clients interacting with an IOCP server at the same time, to validate the server's concurrency. Here's an example in Cygwin:

for i in {1..5} ; do ./SimpleSocketClient.exe localhost -t 1>test-$i <file-to-send & done

TLS in a Nutshell

https://gist.github.com/coin8086/1cd0411447066a5a02be6a3e493479e2

Related Skills

View on GitHub
GitHub Stars10
CategoryDevelopment
Updated3mo ago
Forks2

Languages

C++

Security Score

77/100

Audited on Dec 30, 2025

No findings