} // HttpChannel public HttpChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider) { Hashtable clientData = new Hashtable(); Hashtable serverData = new Hashtable(); // divide properties up for respective channels if (properties != null) { foreach (DictionaryEntry entry in properties) { switch ((String)entry.Key) { // general channel properties case "name": _channelName = (String)entry.Value; break; case "priority": _channelPriority = Convert.ToInt32((String)entry.Value, CultureInfo.InvariantCulture); break; case "secure": _secure = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture); clientData["secure"] = entry.Value; serverData["secure"] = entry.Value; break; default: clientData[entry.Key] = entry.Value; serverData[entry.Key] = entry.Value; break; } } } _clientChannel = new HttpClientChannel(clientData, clientSinkProvider); _serverChannel = new HttpServerChannel(serverData, serverSinkProvider); } // HttpChannel
public HttpChannel(int port) { this._channelPriority = 1; this._channelName = "http"; this._clientChannel = new HttpClientChannel(); this._serverChannel = new HttpServerChannel(port); }
/*private void GetCertificate(String domainName) { //String cert = rootServer.GetCertificate(domainName); //String[] certFields = cert.Split(','); //Console.WriteLine(cert); byte[] rawCertData = rootServer.GetCertificate(domainName); if (rawCertData != null) { Certificate.OpenCertificate(); Certificate.AddCertificate(rawCertData); //Console.WriteLine(Convert.ToBase64String(rawCertData)); Console.WriteLine("Certificate has been downloaded successfully."); } }*/ static void Main(string[] args) { RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false); ServerObject serverobj = new ServerObject(); //serverobj.KeyObt("*****@*****.**", DateTime.Now); Console.Write("Enter passphrase: "); passphrase = Console.ReadLine(); passphrase.Trim(); Core core = new Core(passphrase); core.ReadSettingsFile(); Server server = new Server(); server.Connect(core.GetXmlNodeInnerText("root_server")); DatabaseConnection connection = new DatabaseConnection(); String publicKey = core.PublicKey; String dbPublicKey = connection.getPublicKey("server"); connection.close(); StreamWriter writer = new StreamWriter(core.ActionLogFile, true); if (publicKey != dbPublicKey) { writer.Write(DateTime.Now.ToString() + Core.space); writer.WriteLine("Server's old public key:"); writer.WriteLine(); writer.WriteLine(dbPublicKey); writer.WriteLine(); //connection = new DatabaseConnection(); //connection.setPublicKey("server", "server", publicKey); connection.updatePublicKey("server", "server", publicKey); Console.Write(DateTime.Now.ToString() + Core.space); Console.WriteLine("New key pair is set."); } connection.close(); writer.Write(DateTime.Now.ToString() + Core.space); writer.WriteLine("Server's public key:"); writer.WriteLine(); writer.WriteLine(publicKey); writer.WriteLine(); writer.Write(DateTime.Now.ToString() + Core.space); writer.WriteLine("Server started"); writer.Close(); Console.Write(DateTime.Now.ToString() + Core.space); Console.WriteLine("PractiSES Server started."); HttpServerChannel channel = new HttpServerChannel(80); ChannelServices.RegisterChannel(channel,false); RemotingConfiguration.RegisterWellKnownServiceType( typeof(PractiSES.ServerObject), "PractiSES", WellKnownObjectMode.SingleCall); System.Console.ReadLine(); }
} // HttpChannel /// <include file='doc\CombinedHttpChannel.uex' path='docs/doc[@for="HttpChannel.HttpChannel2"]/*' /> public HttpChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider) { Hashtable clientData = new Hashtable(); Hashtable serverData = new Hashtable(); // divide properties up for respective channels if (properties != null) { foreach (DictionaryEntry entry in properties) { switch ((String)entry.Key) { // general channel properties case "name": _channelName = (String)entry.Value; break; case "priority": _channelPriority = Convert.ToInt32((String)entry.Value); break; // client properties case "clientConnectionLimit": clientData["clientConnectionLimit"] = entry.Value; break; case "proxyName": clientData["proxyName"] = entry.Value; break; case "proxyPort": clientData["proxyPort"] = entry.Value; break; case "timeout": clientData["timeout"] = entry.Value; break; case "useDefaultCredentials": clientData["useDefaultCredentials"] = entry.Value; break; case "useAuthenticatedConnectionSharing": clientData["useAuthenticatedConnectionSharing"] = entry.Value; break; // server properties case "bindTo": serverData["bindTo"] = entry.Value; break; case "listen": serverData["listen"] = entry.Value; break; case "machineName": serverData["machineName"] = entry.Value; break; case "port": serverData["port"] = entry.Value; break; case "suppressChannelData": serverData["suppressChannelData"] = entry.Value; break; case "useIpAddress": serverData["useIpAddress"] = entry.Value; break; case "exclusiveAddressUse": serverData["exclusiveAddressUse"] = entry.Value; break; default: break; } } } _clientChannel = new HttpClientChannel(clientData, clientSinkProvider); _serverChannel = new HttpServerChannel(serverData, serverSinkProvider); } // HttpChannel
public ParameterServer(int portNumber) { _channel = new HttpServerChannel("param", portNumber, new XmlRpcServerFormatterSinkProvider()); var tmp = new Uri(_channel.GetChannelUri()); ParameterServerUri = new Uri("http://" + Ros.HostName + ":" + tmp.Port + "/param"); ChannelServices.RegisterChannel(_channel, false); RemotingServices.Marshal(this, "param"); }
public HttpChannel (IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider) { if (properties != null && properties.Contains ("name")) { this.name = (string)properties["name"]; } client = new HttpClientChannel (properties, clientSinkProvider); server = new HttpServerChannel (properties, serverSinkProvider); }
} // HttpChannel /// <include file='doc\CombinedHttpChannel.uex' path='docs/doc[@for="HttpChannel.HttpChannel2"]/*' /> public HttpChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider) { Hashtable clientData = new Hashtable(); Hashtable serverData = new Hashtable(); // divide properties up for respective channels if (properties != null) { foreach (DictionaryEntry entry in properties) { switch ((String)entry.Key) { // general channel properties case "name": _channelName = (String)entry.Value; break; case "priority": _channelPriority = Convert.ToInt32((String)entry.Value); break; // client properties case "clientConnectionLimit": clientData["clientConnectionLimit"] = entry.Value; break; case "proxyName": clientData["proxyName"] = entry.Value; break; case "proxyPort": clientData["proxyPort"] = entry.Value; break; case "useDefaultCredentials": clientData["useDefaultCredentials"] = entry.Value; break; // server properties case "bindTo": serverData["bindTo"] = entry.Value; break; case "listen": serverData["listen"] = entry.Value; break; case "machineName": serverData["machineName"] = entry.Value; break; case "port": serverData["port"] = entry.Value; break; case "suppressChannelData": serverData["suppressChannelData"] = entry.Value; break; case "useIpAddress": serverData["useIpAddress"] = entry.Value; break; default: throw new ArgumentException( String.Format( CoreChannel.GetResourceString( "Remoting_Channels_BadCtorArgs"), entry.Key)); } } } _clientChannel = new HttpClientChannel(clientData, clientSinkProvider); _serverChannel = new HttpServerChannel(serverData, serverSinkProvider); } // HttpChannel
//setup HTTP server channel public void InitializeServerChannel(string name, int port, bool enableSecurity) { RemotingUtils.RemoveChannel(name); var sinkProvider = new BinaryServerFormatterSinkProvider(); sinkProvider.TypeFilterLevel = TypeFilterLevel.Full; var channel = new System.Runtime.Remoting.Channels.Http.HttpServerChannel(name, port, sinkProvider); ChannelServices.RegisterChannel(channel, enableSecurity); }
public void StartHttpServer () { if (serverChannel != null) return; serverChannel = new HttpServerChannel ("HttpServerChannelTests", port); ChannelServices.RegisterChannel (serverChannel); RemotingConfiguration.RegisterWellKnownServiceType ( typeof (RemoteObject), "RemoteObject.rem", WellKnownObjectMode.Singleton); }
public HttpChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider) { if (properties != null && properties.Contains("name")) { this.name = (string)properties["name"]; } client = new HttpClientChannel(properties, clientSinkProvider); server = new HttpServerChannel(properties, serverSinkProvider); }
private void SetupChannel (IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider) { clientChannel = new HttpClientChannel (properties, clientSinkProvider); serverChannel = new HttpServerChannel (properties, serverSinkProvider); object val = properties ["name"]; if (val != null) channelName = val as string; val = properties ["priority"]; if (val != null) channelPriority = Convert.ToInt32 (val); this.properties = new AggregateDictionary (new IDictionary[] {clientChannel, serverChannel}); }
public Form1() { InitializeComponent(); // todo: start the remoting server HttpServerChannel HttpChannel = new HttpServerChannel(ServerStaticMembers.ChannelName, ServerStaticMembers.Port); //RemotingConfiguration.Configure(httpChannel, false); ChannelServices.RegisterChannel(HttpChannel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(SingletonServer), ServerStaticMembers.ChannelName, WellKnownObjectMode.Singleton); IServerModel ServerModel = (SingletonServer)Activator.GetObject(typeof(SingletonServer), "http://" + ServerStaticMembers.Host + ":" + ServerStaticMembers.Port.ToString() + "/SingletonServer"); }
public void Start() { WebLabDotNetDummy.Server = this.experimentServer; IServerChannelSinkProvider formatter = new CookComputing.XmlRpc.XmlRpcServerFormatterSinkProvider(); HttpServerChannel channel = new HttpServerChannel("WebLab-Deusto", this.port, formatter); ChannelServices.RegisterChannel(channel, false); RemotingConfiguration.RegisterWellKnownServiceType( typeof(WebLabDeusto.WebLabDotNetDummy), this.servicePath, WellKnownObjectMode.Singleton ); }
protected override void OnStart(string[] args) { hts = new HttpServerChannel(8228); ChannelServices.RegisterChannel(hts); RemotingConfiguration.RegisterWellKnownServiceType(typeof(CustomerLoader), "CustomerLoader", WellKnownObjectMode.Singleton); WriteFile.WriteToFile("Service is started at " + DateTime.Now); //HostObject(); timer.Elapsed += new ElapsedEventHandler(OnElapsedTimeAsync); timer.Interval = 5000; //number in milisecinds timer.Enabled = true; timer.AutoReset = false; }
static void Main(string[] args) { /* Uncomment out the Setting Channel Properties region for page 15 of the chapter. * Then comment out the TcpChannels region * */ #region Setting Channel Properties IDictionary properties = new Hashtable(); properties["name"] = "TCP Channel with a SOAP Formatter"; properties["priority"] = "20"; properties["port"] = "8086"; SoapServerFormatterSinkProvider sinkProvider = new SoapServerFormatterSinkProvider(); TcpServerChannel tcpChannel = new TcpServerChannel(properties, sinkProvider); ShowChannelProperties(tcpChannel); #endregion #region TcpChannels // TcpServerChannel tcpChannel = new TcpServerChannel(8086); // ShowChannelProperties(tcpChannel); #endregion #region HttpChannel HttpServerChannel httpChannel = new HttpServerChannel(8085); ShowChannelProperties(httpChannel); #endregion #region RegisterChannels ChannelServices.RegisterChannel(tcpChannel); ChannelServices.RegisterChannel(httpChannel); #endregion /* HttpServerChannel channel = (HttpServerChannel)ChannelServices.GetChannel("http"); channel.StopListening(null); */ RemotingConfiguration.RegisterWellKnownServiceType( typeof(Hello), "Hi", WellKnownObjectMode.SingleCall); System.Console.WriteLine("hit to exit"); System.Console.ReadLine(); }
static void Main(string[] args) { Certificate.OpenCertificate(); Console.WriteLine("PractiSES Root Server started."); HttpServerChannel channel = new HttpServerChannel(88); ChannelServices.RegisterChannel(channel, false); RemotingConfiguration.RegisterWellKnownServiceType( typeof(PractiSES.RootServerObject), "PractiSES_Root", WellKnownObjectMode.SingleCall); System.Console.ReadLine(); }
public MasterServer(int portNumber) { _channel = new HttpServerChannel("master", portNumber, new XmlRpcServerFormatterSinkProvider()); var tmp = new Uri(_channel.GetChannelUri()); MasterUri = new Uri("http://" + Ros.HostName + ":" + tmp.Port); ChannelServices.RegisterChannel(_channel, false); RemotingServices.Marshal(this, "/"); _parameterServer = new ParameterServer(MasterUri); _logger.Info(m => m("MasterServer launched {0}", MasterUri.ToString())); }
public HttpChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider) { this._channelPriority = 1; this._channelName = "http"; Hashtable hashtable = new Hashtable(); Hashtable hashtable2 = new Hashtable(); if (properties != null) { foreach (DictionaryEntry entry in properties) { string key = (string)entry.Key; if (key == null) { goto Label_00F4; } if (!(key == "name")) { if (key == "priority") { goto Label_0099; } if (key == "secure") { goto Label_00B7; } goto Label_00F4; } this._channelName = (string)entry.Value; continue; Label_0099: this._channelPriority = Convert.ToInt32((string)entry.Value, CultureInfo.InvariantCulture); continue; Label_00B7: this._secure = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture); hashtable["secure"] = entry.Value; hashtable2["secure"] = entry.Value; continue; Label_00F4: hashtable[entry.Key] = entry.Value; hashtable2[entry.Key] = entry.Value; } } this._clientChannel = new HttpClientChannel(hashtable, clientSinkProvider); this._serverChannel = new HttpServerChannel(hashtable2, serverSinkProvider); }
/// <summary> /// Inicializa el hosr remoting por marshalling de un objeto (singleton) /// </summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event argument.</param> private void InicializarPorMarsall_Click(object sender, EventArgs e) { try { HttpServerChannel channel = new HttpServerChannel(8989); ChannelServices.RegisterChannel(channel, false); _myObjetoRemoto = new MyObjetoRemoto(); RemotingServices.Marshal(_myObjetoRemoto, "MyObjetoRemoto.rem"); MessageBox.Show("Objeto Inicializado con exito !", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); gbxMarshalling.Enabled = true; btnInicializeHost.Enabled = false; } catch (Exception er) { MessageBox.Show(string.Format("Error:\n{0}", er.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public HttpChannel(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider) { this._channelPriority = 1; this._channelName = "http"; Hashtable hashtable = new Hashtable(); Hashtable hashtable2 = new Hashtable(); if (properties != null) { foreach (DictionaryEntry entry in properties) { string key = (string) entry.Key; if (key == null) { goto Label_00F4; } if (!(key == "name")) { if (key == "priority") { goto Label_0099; } if (key == "secure") { goto Label_00B7; } goto Label_00F4; } this._channelName = (string) entry.Value; continue; Label_0099: this._channelPriority = Convert.ToInt32((string) entry.Value, CultureInfo.InvariantCulture); continue; Label_00B7: this._secure = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture); hashtable["secure"] = entry.Value; hashtable2["secure"] = entry.Value; continue; Label_00F4: hashtable[entry.Key] = entry.Value; hashtable2[entry.Key] = entry.Value; } } this._clientChannel = new HttpClientChannel(hashtable, clientSinkProvider); this._serverChannel = new HttpServerChannel(hashtable2, serverSinkProvider); }
internal SlaveServer(string nodeId, int portNumber, TopicContainer topicContainer) { NodeId = nodeId; _logger = RosOutLogManager.GetCurrentNodeLogger(NodeId); _topicContainer = topicContainer; _tcpRosListener = new Dictionary<string, TcpRosListener>(); string slaveName = "slave" + Guid.NewGuid().ToString("N"); _channel = new HttpServerChannel(slaveName, portNumber, new XmlRpcServerFormatterSinkProvider()); var tmp = new Uri(_channel.GetChannelUri()); SlaveUri = new Uri("http://" + Ros.HostName + ":" + tmp.Port + "/" + slaveName); ChannelServices.RegisterChannel(_channel, false); RemotingServices.Marshal(this, slaveName); //Marshalするときの名前に/を入れるとだめ。 }
public static void Main(string[] args) { TcpServerChannel tcpChannel = new TcpServerChannel(8086); ShowChannelProperties(tcpChannel); HttpServerChannel httpChannel = new HttpServerChannel(8085); ShowChannelProperties(httpChannel); ChannelServices.RegisterChannel(tcpChannel); ChannelServices.RegisterChannel(httpChannel); RemotingConfiguration.RegisterWellKnownServiceType( typeof (Wrox.ProfessionalCSharp.Hello), // Type "Hi", // URI WellKnownObjectMode.SingleCall); // Mode System.Console.WriteLine("hit to exit"); System.Console.ReadLine(); }
void Application_Start(object sender, EventArgs e) { // Code that runs on application startup // server registration using http IDictionary properties = new Hashtable(); properties["machineName"] = Properties.Settings.Default.hMailServerWebAdminMachineName; HttpServerChannel channel = new HttpServerChannel(properties, null); ChannelServices.RegisterChannel(channel, false); LifetimeServices.LeaseTime = TimeSpan.FromMinutes(10); LifetimeServices.RenewOnCallTime = TimeSpan.FromMinutes(15); RemotingConfiguration.RegisterWellKnownServiceType(new WellKnownServiceTypeEntry( typeof(hMailServerNetRemote.ClassFactory), "Remote.soap", WellKnownObjectMode.SingleCall )); // client registration (for calling a server) using http BinaryClientFormatterSinkProvider clnt = new BinaryClientFormatterSinkProvider(); HttpClientChannel client = new HttpClientChannel((IDictionary) null, clnt); ChannelServices.RegisterChannel(client, false); }
} // HttpChannel /// <include file='doc\CombinedHttpChannel.uex' path='docs/doc[@for="HttpChannel.HttpChannel1"]/*' /> public HttpChannel(int port) { _clientChannel = new HttpClientChannel(); _serverChannel = new HttpServerChannel(port); } // HttpChannel
public static void PrepareSetService(int port) { var serverChannel = new HttpServerChannel(port); ChannelServices.RegisterChannel(serverChannel, false); }
private static void RegisterRemoting() { Hashtable hashtable = new Hashtable(); BinaryServerFormatterSinkProvider sinkProvider = new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full }; HttpServerChannel chnl = new HttpServerChannel("HttpBinary", HttpPort, sinkProvider); ChannelServices.RegisterChannel(chnl, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(HibernateImpl), "DBDAO", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(typeof(WorkflowClient), "WorkflowClient", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(typeof(SQLDataEngine), "DataEngine", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteUpdate), "RemoteUpdate", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(typeof(DataWordService), "DataWordDAO", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(typeof(DataFormDAOService), "DataFormDAOService", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(typeof(CriteriaDAOService), "CriteriaDAOService", WellKnownObjectMode.Singleton); //RemotingConfiguration.RegisterWellKnownServiceType(typeof(ZSTaxService), "ZSTaxService", WellKnownObjectMode.Singleton); RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off; RemotingConfiguration.CustomErrorsEnabled(false); }
public void StartServer() { _httpChannel = new HttpServerChannel(_channelName, _port); //RemotingConfiguration.Configure(httpChannel, false); ChannelServices.RegisterChannel(_httpChannel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(SingletonServer), _channelName, WellKnownObjectMode.Singleton); _server = (SingletonServer)Activator.GetObject(typeof(SingletonServer), _host + ":" + _port.ToString() + "/SingletonServer"); _isListening = true; }
public HttpChannel() { client = new HttpClientChannel(); server = new HttpServerChannel(); }
public HttpChannel (int port) { client = new HttpClientChannel (); server = new HttpServerChannel (port); }
public HttpChannel () { client = new HttpClientChannel (); server = new HttpServerChannel (); }
public frmMain() { InitializeComponent(); this.StartPosition = FormStartPosition.CenterScreen; //此处请设置为从代理商处取得的激活码 Leey.Net.eTerm.LicenseManager.Instance.Key = "ceshiceshiceshi"; ec = new EtermConnection(); ec.OnReadPacket += new EtermConnection.CmdResultHandler(ec_OnReadPacket); ec.OnSendPacket += new EtermConnection.PacketHandler(ec_OnSendPacket); ec.OnLogin +=new Leey.Net.eTerm.Net.ObjectHandler(ec_OnLogin); ec.OnUnLogin+=new Leey.Net.eTerm.Net.ObjectHandler(ec_OnUnLogin); ec.OnEtermConnectionStateChanged+=new EtermConnection.EtermConnectionStateHandler(ec_OnEtermConnectionStateChanged); ec.OnGetChkCode += new EtermConnection.ChkCodeHandler(ec_OnGetChkCode); ec.OnError += new Leey.Net.eTerm.Net.ErrorHandler(ec_OnError); //ec.LocalIP = "10.108.16.20"; //连续执行指令之间的间隔。 对于新申请的航信配置可适当设置此参数,避免指令执行过快出现 Transation in process 错误。 ec.ExeInterval = 1000; //实现REMOTING HttpServerChannel channel = new HttpServerChannel(8081); ChannelServices.RegisterChannel(channel,false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyRemotableObject), "HelloWorld.rem", WellKnownObjectMode.Singleton); RemotableObjects.Cache.Attach(this); //启动日志记录 LogManager.Instance.LoadConfiguration(); LogManager.Instance.Log.Info("应用程序启动"); }
} // HttpChannel public HttpChannel(int port) { _clientChannel = new HttpClientChannel(); _serverChannel = new HttpServerChannel(port); } // HttpChannel
public HttpChannel(int port) { client = new HttpClientChannel(); server = new HttpServerChannel(port); }