static void Main(string[] arg) { SecurePlugin.Factory factory = new SecurePlugin.Factory ("test-pub-priv-key.snk"); SecurePlugin.IDPair pair = factory.BuildSecurePlugin (arg[0]); SecurePlugin.DataBase db = new SecurePlugin.DataBase(); db.Insert (pair.license_id, pair.plugin_id); db.Print(); TcpClient client = null; TcpListener server = null; try { server = new TcpListener (IPAddress.Parse ("127.0.0.1"), 6969); server.Start(); while (true) ThreadPool.QueueUserWorkItem (new LicenseHandler (server.AcceptTcpClient (), db).Start); } catch (SocketException e) { Console.WriteLine ("SocketException: {0}", e); } finally { server.Stop(); } }
public LicenseHandler(TcpClient c, SecurePlugin.DataBase d) { db = d; client = c; stream = client.GetStream(); }