remoting例子

C#Remoting超简单实例 一个非常简单的Remoting实例,适合Remoting入门学习, 立即下载

///////////服务端

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DataInterface
{
    /// <summary>
    /// 运算接口
    /// </summary>
    public interface Icalculate
    {
        /// <summary>
        /// 加法
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        double Add(double x,double y);
        /// <summary>
        /// 减法
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        double Subtract(double x, double y);
        /// <summary>
        /// 乘法
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        double Multiply(double x, double y);
        /// <summary>
        /// 除法
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        double Division(double x, double y);
    }
}

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataInterface;

namespace AccessData
{
    /// <summary>
    /// 实现运算接口
    /// </summary>
    public class calculate :Icalculate
    {
        #region Icalculate 成员
        public double Add(double x, double y)
        {
            return x + y;
        }
        public double Subtract(double x, double y)
        {
            return x - y;
        }
        public double Multiply(double x, double y)
        {
            return x * y;
        }
        public double Division(double x, double y)
        {
            return x / y;
        }
        #endregion
    }
}

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataInterface;

namespace AccessData
{
    /// <summary>
    /// 抛出边界访问对象 要继承MarshalByRefObject
    /// </summary>
    public class calculateRemotingProxy:MarshalByRefObject,Icalculate
    {
        Icalculate calculateremotingproxy;
        public calculateRemotingProxy()
        {
            calculateremotingproxy = new calculate();
        }
        #region Icalculate 成员

        public double Add(double x, double y)
        {
            return calculateremotingproxy.Add(x, y);
        }

        public double Subtract(double x, double y)
        {
            return calculateremotingproxy.Subtract(x, y);
        }

        public double Multiply(double x, double y)
        {
            return calculateremotingproxy.Multiply(x, y);
        }

        public double Division(double x, double y)
        {
            return calculateremotingproxy.Division(x, y);
        }

        #endregion
    }
}

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using DataInterface;
using AccessData;

namespace remotingserver
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("服务已启动!");
            TcpServerChannel serverchannel = new TcpServerChannel(8811);//服务器信道
            ChannelServices.RegisterChannel(serverchannel);//注册信道
            //此处要注册的实现类而非接口 注册公布对象
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(calculateRemotingProxy), "calculate", WellKnownObjectMode.SingleCall);
            Console.ReadLine();
        }
    }
}

 

///客户端 要引用接口

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using DataInterface;

namespace remotingclient
{
    class Program
    {
        static void Main(string[] args)
        {
            TcpClientChannel clientchannel = new TcpClientChannel();//客户端通道
            ChannelServices.RegisterChannel(clientchannel);//注册通道
            //此处获得接口
            Icalculate obj1 =(Icalculate) Activator.GetObject(typeof(Icalculate), "tcp://localhost:8811/calculate");
            double result = obj1.Add(11.0, 34.0);
            Console.WriteLine(result.ToString());
            Console.ReadLine();
        }
    }
}

remoting的例子 两个进程之间通信,firstexe是服务器端,secondexe是客户端,开启这两个进程,在客户端的UI界面输入信息,点发送,服务器端UI界面可以接收到 立即下载

相关推荐

RLC电阻电容电感基础知识——电感篇

电感 等效电路 电感线圈由铜导线绕制,等效电路如图所示。 寄生电阻RS,包括了绕线电阻、引脚串联电阻以及磁芯损耗电阻三部分组成,其中绕线电阻与线径、长度、铜线电阻率有关;引脚电阻与引线长短、粗细有关;磁芯损耗电阻与磁芯材料特性有关,显然磁芯损耗电阻还与工作频率有关.寄生电容C主要是绕线圈与圈之间的杂散电容(为PF级),与绕线工艺有关。 等效导纳 显然: (1)当角频率ω(频率f)较小时,呈电感性. (2)当角频率ω等于ω0时,导纳Y虚部为0,呈现电阻性,即发生共振。令导纳Y虚部为0,即可求出共振角频率ω

azj2019的博客 1万+

简单Remoting例子

参考MSDN给出的例子   包含Remoting两种协议(tcp,http)的代码,其中在RemoteObject类添加数据访问的代码,则可实现NET Framwork间的简单分布式数据库程序。     1.服务端: using System; using System.Collections.Generic; using System.Linq; using System.

luoxianglin0970的专栏 750

Mac M1安装Hive

如果你确定装过mysql,但是执行上述命令后,发现不存在mysql命令,那说明你的系统环境没有配置。出现一段空白,接着出现Initialization script completed。关闭hiveServer2时,执行如下命令查看hive进程;执行上面命令后,若有结果输出,则证明配置完成了。如果出现mac权限问题,解决方法参考。就可以见到hive的web界面了。若出现路径,则存在mysql。配置好后保存,使配置文件生效。用户名hive,密码hive。用户名通过如下命令查看。通过如下命令杀死该进程。

总结复盘,才能不迷失自己! 2388

Remoting简单实例[]

转载自:[http://user.qzone.qq.com/51566219]一、实用类:1、System.MarshalByRefObject :       系统中远程调用的对象必须是从MarshalByRefObject对象中派生出来的;2、System.Runtime.Remoting.Channels.Tcp.TcpServerChannel :       服务器端的Tcp信道;3

wss1801的专栏 1777

NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty()

Please use torch.nn.Module.to_empty() instead of torch.nn.Module.to()输出(llama) (base) [root@localhost home]# nvidia-smi Unable to determine the device handle for GPU0000:09:00.0: Unknown Error。这是典型的“孤儿进程”,但它还是。(僵尸进程),占用 GPU 资源。如果进程仍然不消失,并且。,这意味着它的父进程是。

m0_61636632的博客 2096

[MR]RCM约束下的手术机器人

RCM(Remote Center of Motion)约束,通俗讲就是做微创手术时,机械臂插进身体,机械臂受身体的插入点的约束,不能乱动。 相关参考论文 Task Control with Remote Center of Motion Constraint for Minimally Invasive Robotic Surgery ...

土豆大叔的博客 4579

(原创)一步一步学Remoting之一:从简单开始

                      一步一步学Remoting之一:从简单开始 一、Remoting的优缺点? 优点: 1、能让我们进行分布式开发 2、Tcp通道的Remoting速度非常快 3、虽然是远程的,但是非常接近于本地调用对象 4、可以做到保持对象的状态 5、没有应用程序限制,可以是控制台,winform,iis,windows服务承载远程对象 缺点: 1、非标准的应用

533

MacTeX+TeXstudio:Macbook配置本地Latex看这一篇就够了

这个博客记录本人在MacBook上配置本地Latex的流程,其中选择的编译环境为MacTeX,编辑器为TeXstudio。采用的原因主要两点:一个是本人配置的原因主要是用来撰写毕业论文,希望能够尽可能简化设置流程,专注内容表达;第二是由于本人还有一个windows系统的笔记本,想要编辑器在专注写作体验的同时在两个系统上能够都适配,从而减少切换效率,故选择此组合。这篇文章介绍并详细记录了本人的安装流程,有相同需求的同志也可借鉴。

Katherine-XY的博客 6982

remoting服务例子

1、remoting-servlet.xml [code="xml"] [/code] 备注:该文件必须放在“WEB-INF/”下面。 2、remoting-client.xml [code="java"] [/code] 3、web.xml配置 [code="java"] re...

xiongmimi的博客 279

SAP 深入理解库存

当 某个期间发生货物移动的时候,系统在更新mard数据的之前(这个表是实时更新的),会检查此笔业务过账期间和mard里对应记录的期间是否一致,也就是 看这是不是本期间第一笔移动。其二,我们不能保证这定期的作业的确定性,硬件维护、系统性能都可能使这预定的“时刻”出现偏差,如果某一次没能抓取该时刻的库存,对整个报表来说,是数据的缺失;中,当某一期间(Period)的第一项操作更新了物料数量或价值,则SAP系统会向表MBEWH写入一条记录,以第一项操作之前的余额、价格控制为标准。这对于业务数据量大的。

matinal 當冬夜漸暖 。公众号:matinal 3621

【OCPP】ocpp1.6J协议框架说明

本文档的目的是为读者提供创建正确的可互操作 OCPP JSON 实现 (OCPP-J) 所需的信息。我们将根据我们自己的经验,尝试解释什么是强制性的、什么是良好做法以及什么是不应该做的。毫无疑问,误解或歧义仍然存在,但我们旨在通过本文件尽可能地防止它们。IANA:互联网数字分配机构(OCPP-J:使用JSON通过WebSocket进行OCPP通信。特定的OCPP版本应使用J扩展进行指示。OCPP1.5J表示我们正在讨论1.5版本的JSON/WebSocket实现。

qq_53871375的博客 1241

C# Remoting的一个简单例子

 C# Remoting的一个简单例子2007-10-26 09:07.Net对于远程调用提供了两种方法:Remoting和WebService。WebService现在是如火如荼,特别是有一种比较流行的架构:Winform+WebService(Java、.Net),我曾经做过的一个项目就是这样子的,分布式、跨平台、极佳的用户体验,这三者结合起来是不是很诱人?不过,这

jevinmeng的专栏 534

特别章节-0.1 SolidWorks导出机械臂的URDF模型各个关节坐标系设置

通过Solidworks导出机械臂的URDF模型文件,建立机械臂的各个关节坐标系的规则以及注意点,详细步骤

六眼飞鱼的博客 1万+

C# Remoting例子

4-23 https://www.cnblogs.com/zhengyun_ustc/archive/2006/06/09/remoting_InvalidCredentialException.html 今天看了一篇C# Remoting的一个简单例子,博主简单的介绍了remoting,目前所开发的系统也用到了remoting,特意重温了下系统,发觉其实也就那么回事情,服务器端定...

dayao8092的博客 216

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

简单的Remoting例子

一、Remoting的优缺点?优点:1、能让我们进行分布式开发2、Tcp通道的Remoting速度非常快3、虽然是远程的,但是非常接近于本地调用对象4、可以做到保持对象的状态5、没有应用程序限制,可以是控制台,winform,iis,windows服务承载远程对象缺点:1、非标准的应用因此有平台限制2、脱离iis的话需要有自己的安全机制二、Remoting和Web服务的区别? ASP.NET...

weixin_30633405的博客 111

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

Spring remoting简单例子

Spring目前提供了对RMI、HttpInvoker、Hessian、Burlap及WebService等Remoting技术的集成。Spring屏蔽了这些实现技术的差异,用户只需开发简单的Java对象(Plain Old Java Objects,POJO)然后按照Spring规定的格式进行配置文件的编写即可。 6.2.1  Hessian使用演示 【例6.1】在Spring中使用Hess

kjfcpua的专栏 3004

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

c# Remoting小例子

///近最项目用到了Remoting ,自己学习了一下,在这里记一下。 //要用到的命名空间 using System.Runtime; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; ...

weixin_34362875的博客 126

Remoting例子

1、服务器端的代码 1-1 Service对象 public class Singer:MarshalByRefObject { public string Sing(string str) { return "i'm sing..." + str; } } 1-2 宿主 class Program...

weixin_30553837的博客 77
上一篇: 大小字母排序
下一篇: require和include区别测试 php
andycode
博客等级 码龄17年 12粉丝 80原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值