Giter Site home page Giter Site logo

winsocket's Introduction

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

winsocket's People

Contributors

coin8086 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.