static void Main(string[] args) { try { //// 使用tcp建立通道,port為8050 var tcpChannel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(8050); //// 註冊剛剛建立的tcp channel,這邊使用簡單的範例所以將ensureSecurity設為false System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(tcpChannel, false); //// 使用http建立通道,port為8051 System.Runtime.Remoting.Channels.Http.HttpChannel httpChannecl = new System.Runtime.Remoting.Channels.Http.HttpChannel(8051); //// 註冊剛剛建立的http channel,這邊使用簡單的範例所以將ensureSecurity設為false System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(httpChannecl, false); //// 註冊 Remoting 服務的物件與物件啟動的方式(SingleCall) //// WellKnownObjectMode有兩種 //// Singleton 每個內送訊息都是由新的物件執行個體 (Instance) 服務。 //// SingleCall 每個內送訊息都是由同一個物件執行個體服務。 System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType( typeof(InterfaceOfWork), "RemotingTest", System.Runtime.Remoting.WellKnownObjectMode.SingleCall); } catch (Exception e) { Console.WriteLine(e.Message); } Console.ReadLine(); }
private void btnSchedule_Click(object sender, System.EventArgs e) { int nmarks = Convert.ToInt32(new SySal.OperaDb.OperaDbCommand("SELECT COUNT(*) FROM tb_templatemarksets WHERE id_eventbrick = " + _brick, Conn).ExecuteScalar()); if (nmarks < 2) { MessageBox.Show("Scanning not allowed! Brick " + _brick + " has " + nmarks + " marks.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } System.Runtime.Remoting.Channels.Tcp.TcpChannel ch = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(ch, false); SySal.DAQSystem.BatchManager BM = (SySal.DAQSystem.BatchManager)System.Runtime.Remoting.RemotingServices.Connect(typeof(SySal.DAQSystem.BatchManager), "tcp://" + BatchManager + ":" + ((int)SySal.DAQSystem.OperaPort.BatchServer).ToString() + "/BatchManager.rem"); SySal.DAQSystem.Drivers.VolumeOperationInfo xinfo = new SySal.DAQSystem.Drivers.VolumeOperationInfo(); xinfo.BrickId = _brick; SySal.DAQSystem.Drivers.TaskStartupInfo ts = new TaskStartupInfo(); SySal.DAQSystem.Drivers.TaskStartupInfo tsinfo = xinfo; tsinfo.MachineId = _machine; tsinfo.OPERAUsername = OPERAUserNameText.Text; tsinfo.OPERAPassword = OPERAPasswordText.Text; tsinfo.ProgramSettingsId = _programsettings; tsinfo.MachineId = _machine; tsinfo.Notes = textNotes.Text + " " + InterruptString; System.Data.DataSet ds = new System.Data.DataSet(); new SySal.OperaDb.OperaDbDataAdapter("select avg(pred_localx), avg(pred_localy) from vw_local_predictions where id_cs_eventbrick = " + _brick, Conn).Fill(ds); double x = Convert.ToSingle(ds.Tables[0].Rows[0][0]); double y = Convert.ToSingle(ds.Tables[0].Rows[0][1]); try { long parent_id = 0; try { parent_id = Convert.ToInt64(new SySal.OperaDb.OperaDbCommand("select tb_proc_operations.id from tb_proc_operations inner join tb_programsettings on (tb_proc_operations.id_programsettings= tb_programsettings.id) where executable='CSHumanDriver.exe' and success='R' and id_eventbrick=" + _brick, Conn).ExecuteScalar()); } catch { } long op = 0; if (MessageBox.Show("PUT OIL!\nArea centered around:\nX = " + x + "\nY = " + y, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { op = BM.Start(parent_id, tsinfo); } if (InterruptString != null) { BM.Interrupt(op, tsinfo.OPERAUsername, tsinfo.OPERAPassword, InterruptString); } } catch (Exception ex) { System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(ch); MessageBox.Show(@"Failed to connect to the BatchManager... " + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } Close(); }
static RoomClient() { //string ConnectString = "metadata=res://*/Model2.csdl|res://*/Model2.ssdl|res://*/Model2.msl;provider=System.Data.SqlClient;provider connection string="Server=192.168.2.24,8605;Database=dbroom;User ID=sa;Password=654321;MultipleActiveResultSets=True""; //System.Data.SqlClient.SqlConnectionStringBuilder sqlConnection = new System.Data.SqlClient.SqlConnectionStringBuilder(); //sqlConnection.DataSource = @"192.168.2.24,8605"; //sqlConnection.ApplicationName = ""; //sqlConnection.InitialCatalog = "dbroom"; //sqlConnection.IntegratedSecurity = true; //sqlConnection.PersistSecurityInfo = true; //sqlConnection.UserID = "sa"; //sqlConnection.Password ="******"; //string connectString = "Server=10.21.99.82;Database=SecureDB;User ID=secure;Password=secure;"; string connectString = "data source=10.21.99.80;initial catalog=SecureDB;persist security info=True;user id=secure;password=secure;MultipleActiveResultSets=True;App=EntityFramework;"; string dir = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; dir = dir.Remove(dir.LastIndexOf('\\')); if (System.IO.File.Exists(dir +@"\Server.txt")) { string serverSet = System.IO.File.ReadLines(dir + @".\Server.txt").First(); if (serverSet.Length < 300) { connectString = serverSet; } } //System.Data.SqlClient.SqlConnection s = new System.Data.SqlClient.SqlConnection(sqlConnection.ConnectionString); //System.Data.EntityClient.EntityConnectionStringBuilder ecsb = new System.Data.EntityClient.EntityConnectionStringBuilder(); //ecsb.Provider = "System.Data.SqlClient"; //ecsb.ProviderConnectionString = sqlConnection.ConnectionString; //ecsb.Metadata = @"res://*/Model2.csdl|res://*/Model2.ssdl|res://*/Model2.msl"; //System.Data.EntityClient.EntityConnection ec = new System.Data.EntityClient.EntityConnection(ecsb.ConnectionString); //dbroomClientEntities dbroom = new dbroomClientEntities(ec); try { System.Data.SqlClient.SqlDataAdapter adapter = new System.Data.SqlClient.SqlDataAdapter("Select * from tblHostConfig;", connectString); System.Data.DataTable DT = new System.Data.DataTable(); adapter.Fill(DT); adapter.Dispose(); objUrl = "tcp://" + DT.Rows[0]["IP"] + ":" + DT.Rows[0]["Port"] + "/RoomObj"; System.Runtime.Remoting.Channels.Tcp.TcpChannel tcp = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(0); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(tcp, false); //var HostData = (from o in dbroom.tblHostConfigs select o).First(); //objUrl = "tcp://" + HostData.IP + ":" + HostData.Port + "/RoomObj"; } catch (Exception ) { throw new Exception("資料庫讀取失敗"); } roomEvent.RoomEvent += new RoomEventHandler(RoomClient_RoomEvent); timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); timer.Interval = 10000; timer.Start(); }
private static void InitializeRemoting(int TcpPort) { // register channel System.Runtime.Remoting.Channels.Tcp.TcpChannel chan = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(TcpPort); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan); // register wellknown type System.Runtime.Remoting.RemotingConfiguration.ApplicationName = "QueryProcessor"; System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(typeof(FI.DataAccess.Serviced.XmlCellsetWrapper), "QueryProcessor", WellKnownObjectMode.Singleton); }
private static void InitializeRemoting(int TcpPort) { // register channel System.Runtime.Remoting.Channels.Tcp.TcpChannel chan=new System.Runtime.Remoting.Channels.Tcp.TcpChannel(TcpPort); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(chan); // register wellknown type System.Runtime.Remoting.RemotingConfiguration.ApplicationName="QueryProcessor"; System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(typeof(FI.DataAccess.Serviced.XmlCellsetWrapper) , "QueryProcessor" , WellKnownObjectMode.Singleton); // System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(typeof(FI.DataAccess.Serviced.XmlCellsetWrapper) , "QueryProcessor" , WellKnownObjectMode.SingleCall); // System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(typeof(FI.DataAccess.Serviced.XmlCellsetWrapper2) , "QueryProcessor2" , WellKnownObjectMode.SingleCall); }
public HTTPTwoWayRemotingServer(string channelName, int maximumConnections, int listenPort, int keepAliveIntervalSeconds) : base(keepAliveIntervalSeconds) { this.channelName = channelName; /*IDictionary sProps = new Hashtable(); * sProps["algorithm"] = "3DES"; * sProps["requireSecurity"] = "true"; * sProps["connectionAgeLimit"] = "120"; * sProps["sweepFrequency"] = "60";*/ BinaryServerFormatterSinkProvider binaryServerFormatSinkProvider = new BinaryServerFormatterSinkProvider(); binaryServerFormatSinkProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; //SecureServerChannelSinkProvider secureServerSinkProvider = new SecureServerChannelSinkProvider(sProps, null); //secureServerSinkProvider.Next = binaryServerFormatSinkProvider; BinaryClientFormatterSinkProvider binaryClientFormatSinkProvider = new BinaryClientFormatterSinkProvider(); //binaryClientFormatSinkProvider.Next = new SecureClientChannelSinkProvider(sProps, null); IDictionary props = new Hashtable(); props["port"] = listenPort; //props["clientConnectionLimit"] = maximumConnections; //props["useIpAddress"] = false; //props["rejectRemoteRequests"] = false; //props["ConnectTimeout"] = 15000; //props["InvocationTimeout"] = 15000; //props["Priority"] = "100"; System.Diagnostics.Trace.WriteLine("***** Starting"); //channel = new System.Runtime.Remoting.Channels.Http.HttpChannel(props, binaryClientFormatSinkProvider, secureServerSinkProvider); //channel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(props, binaryClientFormatSinkProvider, secureServerSinkProvider); channel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(props, binaryClientFormatSinkProvider, binaryServerFormatSinkProvider); //channel = new Belikov.GenuineChannels.GenuineTcp.GenuineTcpChannel(props, binaryClientFormatSinkProvider, binaryServerFormatSinkProvider); //channel.GenuineChannelsEvent += new Belikov.GenuineChannels.DotNetRemotingLayer.GenuineChannelsGlobalEventHandler(channel_GenuineChannelsEvent); }
//private Belikov.GenuineChannels.GenuineTcp.GenuineTcpChannel channel; public HTTPTwoWayRemotingClient(int listenPort, int keepAliveIntervalSeconds) : base(keepAliveIntervalSeconds) { /*IDictionary sProps = new Hashtable(); * sProps["algorithm"] = "3DES"; * sProps["requireSecurity"] = "true"; * sProps["connectionAgeLimit"] = "120"; * sProps["sweepFrequency"] = "60";*/ BinaryServerFormatterSinkProvider binaryServerFormatSinkProvider = new BinaryServerFormatterSinkProvider(); binaryServerFormatSinkProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; //SecureServerChannelSinkProvider secureServerSinkProvider = new SecureServerChannelSinkProvider(sProps, null); //secureServerSinkProvider.Next = binaryServerFormatSinkProvider; BinaryClientFormatterSinkProvider binaryClientFormatSinkProvider = new BinaryClientFormatterSinkProvider(); //binaryClientFormatSinkProvider.Next = new SecureClientChannelSinkProvider(sProps, null); IDictionary props = new Hashtable(); props["port"] = listenPort; //props["useIpAddress"] = false; //props["clientConnectionLimit"] = 1; //props["rejectRemoteRequests"] = false; //props["ConnectTimeout"] = 15000; //props["InvocationTimeout"] = 15000; //props["Priority"] = "100"; //Belikov.GenuineChannels.Security.SecuritySessionServices.SetCurrentSecurityContext(new Belikov.GenuineChannels.Security.SecuritySessionParameters(Belikov.GenuineChannels.Security.SecuritySessionServices.DefaultContext.Name, Belikov.GenuineChannels.Security.SecuritySessionAttributes.ForceSync, TimeSpan.FromSeconds(15), Belikov.GenuineChannels.Connection.GenuineConnectionType.Persistent, null, TimeSpan.FromMinutes(5))); //channel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(props, binaryClientFormatSinkProvider, secureServerSinkProvider); channel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(props, binaryClientFormatSinkProvider, binaryServerFormatSinkProvider); //channel = new System.Runtime.Remoting.Channels.Http.HttpChannel(props, binaryClientFormatSinkProvider, secureServerSinkProvider); //channel = new Belikov.GenuineChannels.GenuineTcp.GenuineTcpChannel(props, binaryClientFormatSinkProvider, binaryServerFormatSinkProvider); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel); }
protected override void OnShown(EventArgs e) { base.OnShown(e); if (this.SingleInstanceProgram) { if (CloseIfNotMainInstance()) { return; } } try { lastInputLanguage = Application.CurrentInputLanguage; InputLanguage persianLang = InputLanguage.FromCulture(System.Globalization.CultureInfo.GetCultureInfo("fa-IR")); if (persianLang == null) { persianLang = InputLanguage.FromCulture(System.Globalization.CultureInfo.GetCultureInfo("fa")); } if (persianLang != null) { Application.CurrentInputLanguage = persianLang; } } catch { } if (this.DesignMode) { return; } if (Options.SettingInitializer == null) { throw new Exception("تنظیمات برنامه پیاده سازی نشده است"); } Options.SettingInitializer.GetProgramSetting().CloseSplashScreen(); if (Options.SettingInitializer != null) { if (!Options.SettingInitializer.GetUserSetting().Login()) { Options.SettingInitializer.GetProgramSetting().ShowExitDialog = false; this.Close(); return; } } UpdateDatabases(); DateTime serverDateTime = Options.SettingInitializer.GetDataAccess().Connection.GetServerDateTime(); TimeSpan timeDifference = serverDateTime.Subtract(DateTime.Now); do { if (timeDifference.TotalMinutes >= Options.SettingInitializer.GetProgramSetting().MinuteDifferenceWithServerToShowMessage || timeDifference.TotalMinutes <= -Options.SettingInitializer.GetProgramSetting().MinuteDifferenceWithServerToShowMessage) { MessageBox.VDialogResult dResult = PersianMessageBox.Show(this, string.Format("این سیستم {0} با سرور اختلاف ساعت دارد\r\nساعت سرور: {1}", timeDifference.GetText(), serverDateTime.ToLongTimeString()), "اختلاف ساعت", new MessageBox.VDialogButton[] { new MessageBox.VDialogButton(MessageBox.VDialogResult.OK, "تایید"), new MessageBox.VDialogButton("تغییر تاریخ / ساعت", ChangeSystemDate, true), new MessageBox.VDialogButton(MessageBox.VDialogResult.Cancel, "خروج از برنامه") }, MessageBox.VDialogIcon.Warning, MessageBox.VDialogDefaultButton.Button1, System.Windows.Forms.RightToLeft.Yes, false, null, null, null, null, null); if (dResult == MessageBox.VDialogResult.Cancel) { Options.SettingInitializer.GetProgramSetting().ShowExitDialog = false; this.Close(); return; } } Njit.Sql.DataAccess da = new Sql.DataAccess(Options.SettingInitializer.GetSqlSetting().DatabaseConnection.ConnectionString); serverDateTime = da.Connection.GetServerDateTime(); timeDifference = serverDateTime.Subtract(DateTime.Now); da.Dispose(); }while (timeDifference.TotalHours >= Options.SettingInitializer.GetProgramSetting().AllowableHourDifferenceWithServer || timeDifference.TotalHours <= -Options.SettingInitializer.GetProgramSetting().AllowableHourDifferenceWithServer); if (this.RegisterSystemUtilityServer) { int registeredChannels = 0; Exception exception = null; try { System.Runtime.Remoting.Channels.Tcp.TcpChannel _TcpChannel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(Options.SettingInitializer.GetProgramSetting().NetworkPort); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(_TcpChannel, false); registeredChannels++; } catch (Exception ex) { exception = ex; } try { System.Collections.IDictionary properties = new System.Collections.Hashtable(); properties["name"] = "tcp6"; properties["port"] = Options.SettingInitializer.GetProgramSetting().NetworkPort; properties["bindTo"] = "[::]"; System.Runtime.Remoting.Channels.Tcp.TcpServerChannel _TcpChannelV6 = new System.Runtime.Remoting.Channels.Tcp.TcpServerChannel(properties, null); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(_TcpChannelV6, false); registeredChannels++; } catch (Exception ex) { exception = ex; } if (registeredChannels > 0) { try { System.Runtime.Remoting.RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off; System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownServiceType(typeof(Njit.Common.SystemUtility), Options.SettingInitializer.GetProgramSetting().NetworkName, System.Runtime.Remoting.WellKnownObjectMode.Singleton); } catch (Exception ex) { PersianMessageBox.Show(this, "خطا در راه اندازی سرور" + "\r\n\r\n" + ex.Message); } } else { PersianMessageBox.Show(this, "خطا در راه اندازی سرور" + "\r\n\r\n" + exception.Message); } } try { Cursor = Cursors.WaitCursor; Njit.Common.SystemUtility systemUtility = Options.SystemUtility; systemUtility.SendMessage(System.Net.Dns.GetHostName(), "--HelloWorld"); } catch (Exception ex) { PersianMessageBox.Show(this, "خطا در اتصال به سرور" + "\r\n" + "اتصال به نرم افزار بر روی سرور با خطا مواجه شده است" + "\r\n" + "توجه داشته باشید که این نرم افزار باید بر روی سرور اجرا شده باشد و یک کاربر وارد سیستم شده باشد" + "\r\n\r\n" + ex.Message); } finally { Cursor = Cursors.Default; } }
/// <summary> /// Richtet einen TCP-Serverkanal ein. Serverkanäle nehmen Anfragen von Clients entgegen. /// /// Bei aktivierung der Sicherheit über den Parameter "enableSecurity", wird die Kommunikation /// vom Absender signiert, um die Integrität sicherzustellen und zusätzlich verschlüsselt. /// Über den Parameter "impersonate" kann Impersonierung eingeschaltet werden. Bei eingeschalteter /// Impersonierung, wird der Remoteaufruf im Kontext des Client-Benutzers ausgeführt. /// </summary> /// <param name="tcpPort">TCP-Anschlussnummer</param> /// <param name="enableSecurity">Schalter für Sicherheit</param> /// <param name="impersonate">Schalter für Impersonierung</param> public static void SetupServerChannel(int tcpPort, bool enableSecurity,bool impersonate) { // Kanalnamen erzeugen string channelName = "RainbirdEasyRemotingServer" + Convert.ToString(tcpPort); // Kanal suchen System.Runtime.Remoting.Channels.IChannel channel = System.Runtime.Remoting.Channels.ChannelServices.GetChannel(channelName); // Wenn der Kanal nicht gefunden wurde ... if (channel == null) { // Konfiguration für den TCP-Kanal erstellen System.Collections.IDictionary channelSettings = new System.Collections.Hashtable(); channelSettings["name"] = channelName; channelSettings["port"] = tcpPort; channelSettings["secure"] = enableSecurity; // Wenn Sicherheit aktiviert ist ... if (enableSecurity) { // Impersonierung entsprechend der Einstellung aktivieren oder deaktivieren channelSettings["tokenImpersonationLevel"] = impersonate ? System.Security.Principal.TokenImpersonationLevel.Impersonation : System.Security.Principal.TokenImpersonationLevel.Identification; // Signatur und Verschlüssung explizit aktivieren channelSettings["protectionLevel"] = System.Net.Security.ProtectionLevel.EncryptAndSign; } // Binäre Serialisierung von komplexen Objekten aktivieren System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider provider = new System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider(); provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; // Neuen TCP-Kanal erzeugen channel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(channelSettings, null, provider); // Kanal registrieren System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel, enableSecurity); } }
//private Belikov.GenuineChannels.GenuineTcp.GenuineTcpChannel channel; public HTTPTwoWayRemotingClient(int listenPort, int keepAliveIntervalSeconds) : base(keepAliveIntervalSeconds) { /*IDictionary sProps = new Hashtable(); sProps["algorithm"] = "3DES"; sProps["requireSecurity"] = "true"; sProps["connectionAgeLimit"] = "120"; sProps["sweepFrequency"] = "60";*/ BinaryServerFormatterSinkProvider binaryServerFormatSinkProvider = new BinaryServerFormatterSinkProvider(); binaryServerFormatSinkProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; //SecureServerChannelSinkProvider secureServerSinkProvider = new SecureServerChannelSinkProvider(sProps, null); //secureServerSinkProvider.Next = binaryServerFormatSinkProvider; BinaryClientFormatterSinkProvider binaryClientFormatSinkProvider = new BinaryClientFormatterSinkProvider(); //binaryClientFormatSinkProvider.Next = new SecureClientChannelSinkProvider(sProps, null); IDictionary props = new Hashtable(); props["port"] = listenPort; //props["useIpAddress"] = false; //props["clientConnectionLimit"] = 1; //props["rejectRemoteRequests"] = false; //props["ConnectTimeout"] = 15000; //props["InvocationTimeout"] = 15000; //props["Priority"] = "100"; //Belikov.GenuineChannels.Security.SecuritySessionServices.SetCurrentSecurityContext(new Belikov.GenuineChannels.Security.SecuritySessionParameters(Belikov.GenuineChannels.Security.SecuritySessionServices.DefaultContext.Name, Belikov.GenuineChannels.Security.SecuritySessionAttributes.ForceSync, TimeSpan.FromSeconds(15), Belikov.GenuineChannels.Connection.GenuineConnectionType.Persistent, null, TimeSpan.FromMinutes(5))); //channel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(props, binaryClientFormatSinkProvider, secureServerSinkProvider); channel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(props, binaryClientFormatSinkProvider, binaryServerFormatSinkProvider); //channel = new System.Runtime.Remoting.Channels.Http.HttpChannel(props, binaryClientFormatSinkProvider, secureServerSinkProvider); //channel = new Belikov.GenuineChannels.GenuineTcp.GenuineTcpChannel(props, binaryClientFormatSinkProvider, binaryServerFormatSinkProvider); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel); }
public HTTPTwoWayRemotingServer(string channelName, int maximumConnections, int listenPort, int keepAliveIntervalSeconds) : base(keepAliveIntervalSeconds) { this.channelName = channelName; /*IDictionary sProps = new Hashtable(); sProps["algorithm"] = "3DES"; sProps["requireSecurity"] = "true"; sProps["connectionAgeLimit"] = "120"; sProps["sweepFrequency"] = "60";*/ BinaryServerFormatterSinkProvider binaryServerFormatSinkProvider = new BinaryServerFormatterSinkProvider(); binaryServerFormatSinkProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; //SecureServerChannelSinkProvider secureServerSinkProvider = new SecureServerChannelSinkProvider(sProps, null); //secureServerSinkProvider.Next = binaryServerFormatSinkProvider; BinaryClientFormatterSinkProvider binaryClientFormatSinkProvider = new BinaryClientFormatterSinkProvider(); //binaryClientFormatSinkProvider.Next = new SecureClientChannelSinkProvider(sProps, null); IDictionary props = new Hashtable(); props["port"] = listenPort; //props["clientConnectionLimit"] = maximumConnections; //props["useIpAddress"] = false; //props["rejectRemoteRequests"] = false; //props["ConnectTimeout"] = 15000; //props["InvocationTimeout"] = 15000; //props["Priority"] = "100"; System.Diagnostics.Trace.WriteLine("***** Starting"); //channel = new System.Runtime.Remoting.Channels.Http.HttpChannel(props, binaryClientFormatSinkProvider, secureServerSinkProvider); //channel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(props, binaryClientFormatSinkProvider, secureServerSinkProvider); channel = new System.Runtime.Remoting.Channels.Tcp.TcpChannel(props, binaryClientFormatSinkProvider, binaryServerFormatSinkProvider); //channel = new Belikov.GenuineChannels.GenuineTcp.GenuineTcpChannel(props, binaryClientFormatSinkProvider, binaryServerFormatSinkProvider); //channel.GenuineChannelsEvent += new Belikov.GenuineChannels.DotNetRemotingLayer.GenuineChannelsGlobalEventHandler(channel_GenuineChannelsEvent); }