2个c#应用程序之间的通信. [英] communication between 2 c# applications.

查看:329
本文介绍了2个c#应用程序之间的通信.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要学习如何从一个c#应用程序向另一个服务器应用程序发送命令,该命令将从数据库中返回数据.我以前从未做过与服务器相关的任何事情,也不知道要寻找什么.任何人都可以向我指出正确的方向.

I need to learn how to send a command from one c# application to another server application that will return data from a database. I have never done anything server related before and don''t know what to look for. Can anyone point me in the right direction please.

推荐答案

您可以使用套接字.这将需要两个程序,一个用于客户端&其他服务器.服务器程序已连接到数据库.客户端程序知道服务器的IP地址&港口.当客户端程序需要数据时,它将向服务器程序请求数据.如果服务器程序发现这是一个有效的请求,则他从数据库&中获取数据.服务于客户端程序.
您可以看到此


点击

点击

点击
You can use socket. It will be need two program, one for client & other server. Server program connected to the data base. Client program know the server ip address & port. When the client program need the data, it request the server program for the data. If the server program see that it is a valid request then he take data from the data base & serve to the client program.
You can see this


Click

Click

Click


我没有"在C#中完成了一段时间的网络代码,但这是一个很好的起点-

http://www.devarticles.com/c /a/C-Sharp/Socket-Programming-in-C-Part-I/1/

它是由两部分组成的文章(该页面上某处的第二篇文章应该有一个链接),因此请务必阅读这两篇文章.
另请注意,它是在一段时间之前编写的,因此某些代码可能已过时.
如果给出的示例不起作用,请尝试在MSDN上搜索,以查看是否有所使用方法/类的更新版本.

希望这可以帮助您入门!
I haven''t done network code in C# for some time, but here''s a good place to start-

http://www.devarticles.com/c/a/C-Sharp/Socket-Programming-in-C-Part-I/1/

It''s a two-part article (there should be a link to the second one on that page somewhere) so be sure to read both.
Also note that it was written some time ago, so some of the code may be out of date.
If the example given doesn''t work, try searching around MSDN to see if there are updated versions of the methods/classes used.

Hope this helps get you started!


这篇关于2个c#应用程序之间的通信.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆