Skip to content

Instantly share code, notes, and snippets.

@yallie
Last active December 15, 2015 20:29
Show Gist options
  • Save yallie/5318799 to your computer and use it in GitHub Desktop.
Save yallie/5318799 to your computer and use it in GitHub Desktop.
Test case which reproduces the bug with remoting channels: https://zyan.codeplex.com/workitem/1814
// https://zyan.codeplex.com/workitem/1814
// Compile: c:\Windows\Microsoft.NET\Framework\v4.0.30319\csc test.cs /r:Zyan.Communication.dll
// Run: test.exe
// Then run: test.exe slave
using System;
using System.Collections;
using System.Linq;
using Zyan.Communication;
using Zyan.Communication.Protocols.Tcp;
using Zyan.Communication.Security;
struct Program
{
static void Main(string[] args)
{
if (args.Any())
RunSlaveServer(args);
else
RunMasterServer();
}
static void RunMasterServer()
{
var port = 1234;
var auth = new NullAuthenticationProvider();
var protocol = new TcpDuplexServerProtocolSetup(port, auth, false);
using (var host = new ZyanComponentHost("MasterServer", protocol))
{
Console.WriteLine("Server started. Press ENTER to quit");
Console.ReadLine();
}
}
static void RunSlaveServer(string[] args)
{
var port = 3456;
var auth = new NullAuthenticationProvider();
var protocol = new TcpDuplexServerProtocolSetup(port, auth, true);
using (var host = new ZyanComponentHost("SlaveServer", protocol))
{
Console.WriteLine("Server started. Connecting to master server...");
var clientProtocol = new TcpDuplexClientProtocolSetup(false);
using (var conn1 = new ZyanConnection("tcpex://localhost:1234/MasterServer", clientProtocol))
{
Console.WriteLine("Connected to master server. Press ENTER to quit.");
Console.ReadLine();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment