问题太模糊,可传递dataset对象来解决。

解决方案 »

  1.   

    see an example here:.NET REMOTING .. ( A simple approach )
    http://www.dotnet247.com/247reference/a.aspx?u=http://www.csharphelp.com/archives/archive272.html
      

  2.   

    这篇文章我看过,但这篇文章介绍的是如何从client端读取Server端的方法来获取数据,但没说Server端如何主动的将数据发送到Client端,Client端又如何得到服务器端发送过来的数据呢?难道Client还需要再建一个Socket连接来监听服务器端发送来的数据吗?如果这样Remoting需要一个端口,Socket连接又需要一个端口,启不是很麻烦??而且这样好像Client端和Server端就互为Server和Client了,结构很乱!!!不知道我说清楚没有
    该怎麽做呢??
      

  3.   

    在Client端也起一个Remoting Object,并且通过事件机制把它的方法注册到Server端,Server端需要发送数据的时候就调用这个Client Remote Object的方法。
      

  4.   

    呵呵!就是把remoting的server端放到你的系统(机器)的client端!或者系统(机器)的client端 查询server端!
      

  5.   

    to 知秋一叶:
        在Client端也起一个Remoting Object,并且通过事件机制把它的方法注册到Server端?不好意思,我不是很明白,您能再说清楚一些吗?在Client端怎样也起一个Remoting Object?是再用一个端口建一个通道吗?
      

  6.   

    client到server,如果从数据角度看,是一个单工,让你再加一个,就是双工了,所以就可以了
      

  7.   

    to qf0421(Amumu):
         如果再加一个那不还是需要两个端口吗?两端互为client、Server啊?!
      

  8.   

    你反过来想:一个client对应n个server,不就行了?
      

  9.   

    to;5drush(五农民出狗狗) 
         我没明白,一个client怎麽能对应多个Server呢?有n个Server就得有n个端口啊!!!
      

  10.   

    因为每个server都是在不同的机器上,那么有n个相同的端口同时也有n个不相同的地址,这样,client端就可以区分开每个server。
      

  11.   

    当然,client端也需要有n个不同的端口来对应n个server,可以设置n条线程来负责对n个server的访问控制。
      

  12.   

    Hi there, from my perception, you have confused yourself with the conception of server and client. Your "client" machine actually acts as a server for the job of getting data from remote site. So it means you can set up a server object runnig at your "client" machine. While at your "server" machine, there should be some program periodically running there and monitoring the data that resides at the same machine. Once the "server" machine find some wrong data, it then initiate the request to send/upload the data to your remote "client" machien. However your "server" machine plays a role of a client (upload client). So it's much clearer now to see that you don't need to set up many remote objects in achieving such a task. What you need to do is to put a remote object in your "client" machine which will help render the report with data from your remote "server" machine. As to your "server" machine, you only need to write a local program with the capability of posting data to outside.To make it simpler, you can just write a web service at your "client" machine which can help receive data from a specific port(by default 80). Of course it can be also written as Remoting object for better performance. In either way it will get the job done for you.
      

  13.   

    to 5drush(五农民出狗狗):
         你说的这个没有意思呀!并不是我想要的啊。我只是想实现点对点的互相通信,如果那样太麻烦了吧,还真没见过这样做程序的??
      

  14.   

    >> to 知秋一叶:
    >>    在Client端也起一个Remoting Object,并且通过事件机制把它的方法>>注册到Server端?不好意思,我不是很明白,您能再说清楚一些吗?在>>Client端怎样也起一个Remoting Object?是再用一个端口建一个通道吗?没错。不过你先仔细看看你现有的Client程序,其实它也建立了一个通道占用了一个端口,只不过这个端口是系统随机选的而已。固定和随机端口的区别仅仅是第一次通信必须有固定地址,这里也没什么影响。所以在实现上你也不用多做什么,只要照通常程序一样的编写event/delegate机制,然后保证event的listener是MarshalByRefObject就可以了(当然还有事件通信中牵扯到的其他类,要么是Serializable,要么MarshalByRef)。client和server本来就只是一个概念,主要是区分谁先主动发起连接,谁被动接受请求提供服务而已,不必把自己局限在这种概念的区分上。尤其是Peer2Peer的应用,多数情况下本来就是互为client/server的。
      

  15.   

    to qqchen79(知秋一叶):
         我还是不明白,因为我的Server只有一个,而Client却有任意个,当Server检测到不合法数据后,主动的发给Client时问题就来了,因为Server并不知道Client端的地址呀,那怎麽能发信息给客户端呢?