Added CSharp example for multi-threaded TLS server. Refactor to separate the ssl and ctx handles.

This commit is contained in:
David Garske
2020-03-19 12:56:19 -07:00
parent a28fc5e70b
commit a8f2c97e13
16 changed files with 631 additions and 124 deletions

View File

@@ -108,7 +108,7 @@ public class wolfSSL_TLS_CSHarp
wolfssl.CTX_SetMinDhKey_Sz(ctx, minDhKey);
/* set up TCP socket */
IPAddress ip = IPAddress.Parse("0.0.0.0"); //bind to any
IPAddress ip = IPAddress.Parse("0.0.0.0"); /* bind to any */
TcpListener tcp = new TcpListener(ip, 11111);
tcp.Start();
@@ -126,7 +126,7 @@ public class wolfSSL_TLS_CSHarp
if (wolfssl.set_fd(ssl, fd) != wolfssl.SUCCESS)
{
/* get and print out the error */
Console.Write(wolfssl.get_error(ssl));
Console.WriteLine(wolfssl.get_error(ssl));
tcp.Stop();
clean(ssl, ctx);
return;
@@ -137,7 +137,7 @@ public class wolfSSL_TLS_CSHarp
if (wolfssl.accept(ssl) != wolfssl.SUCCESS)
{
/* get and print out the error */
Console.Write(wolfssl.get_error(ssl));
Console.WriteLine(wolfssl.get_error(ssl));
tcp.Stop();
clean(ssl, ctx);
return;

View File

@@ -7,7 +7,7 @@
<ProjectGuid>{8921AD35-4E62-4DAC-8FEE-8C9F8E57DDD2}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>wolfSSL_TLS_CSharp</RootNamespace>
<RootNamespace>wolfSSL_TLS_Server</RootNamespace>
<AssemblyName>wolfSSL-TLS-Server</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>