你是如何构建的面向网络的应用程序? [英] How have you structured your network oriented apps?

查看:83
本文介绍了你是如何构建的面向网络的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始就是主要面向网络的新应用程序的设计,我期待从谁想出了一个好的建筑设计,或OOP类模型的人一些建议。

I'm starting the design of a new app that is primarily network oriented, and I'm looking for some advice from people who have come up with a good architectural design, or OOP class model.

请介绍基本的结构和/或类结构。你有没有抽象出的通信位?你什么时候来什么实体类了?

Please describe the basic architecture and/or class structure. Did you abstract out the communication bits? What class entities did you come up with?

该应用程序将同时拥有监听器和客户端类。它类似于一个饲料聚合,但使用HTTP而持久连接。换句话说,我连接到​​插座并在其中数据流两种方式的持久连接。然后我也有连接到我坚持客户和我发送的数据的部分(或全部)给他们。

The app will have both listener and client classes. It's similar to a feed aggregator, but uses persistent connections rather HTTP. In other words, I connect to a socket and have a persistent connection in which data flows both ways. Then I also have clients that connect to me persistently and i send some (or all) of the data to them.

另外,我不能使用WCF或任何在.NET 3.0或3.5(虽然我可以使用C#3,因为我在VS2008开发)。我必须与Windows 2000兼容。

Also, I can't use WCF or anything that's in .NET 3.0 or 3.5 (though I can use C# 3 because i'm developing on VS2008). I have to be compatible with Windows 2000.

推荐答案

我是一个客户端 - 服务器应用程序,我在几个星期前开始写的尾部。我用WCF的.NET cient&安培;服务器。

I am on the tail end of a client-server app that I started writing a few weeks ago. I used WCF for the .Net cient & server.

但是服务器也有连接到网络上的设备,只有理解ASCII通过TCP / IP。

But the server also had to connect to a device on the network that only understood ASCII over TCP/IP.

你抽象出的通信位?

是的。我猜。我的意思是,我不知道我理解你的问题100%。对于我的TCP连接到第三方设备我躲在TCP连接和通信类我写后面的细节。有问题的设备ASCII命令转换为红外信号来控制之类的卫星天线和DVD播放器。我的抽象TCP通信到一个类所以我所有的服务器必须要做的就是像一个电话:

Yes. I guess. I mean, I am not sure I understand your question 100%. For my TCP connection to the 3rd party device I hid the details of the TCP connection and communication behind a class I wrote. The device in question converts ASCII commands to IR signals to control things like satellite dishes and DVD players. I abstracted the TCP communication into a class so all my server had to do is make a call like:

_irService.SendCommand(someAsciiCommand);

你什么时候来什么实体类了?

他们根据我的域名。你应该根据什么您的域名是。我不知道我的理解超出了这个问题。您的域名是要决定你的对象。

They were based on my domain. Yours should be based on whatever your domain is. I am not sure I understand that question beyond that. Your domain is going to dictate your objects.

在我的领域我正在处理的是负责调度的服务器应用程序,并在UDP上使用VLC播放组播广播。这些多播广播必须是在各方面配置。

In my domain I was dealing with a server application that was in charge of scheduling and playing multicast broadcasts over UDP utilizing VLC. These multicast broadcasts had to be configurable in every aspect.

当我分析我想出了包括广播,电视,设备和BroadcastProcesses(这是负责启动vlc.exe过程和维持其生命周期的一类)模型的域。

When I analyzed the domain I came up with a model that consisted of Broadcasts, Channels, Devices and BroadcastProcesses (a class that was in charge of starting a vlc.exe process and maintaining its lifecycle).

域名对网络技术的影响不大。我结束了在WCF,让我来操作域少数复式的服务。但网络选择没有被域决定。我想用我的对象的二进制序列化一个TCP连接,我想与服务器的双向沟通​​,让我的客户可以通过回调得到实时更新。这些选项是提供给我,无论什么我的域名样子。

The domain had little impact on the networking technology. I ended up with a few duplex "services" in WCF that allowed me to manipulate the domain. But the networking choices were not dictated by the domain. I wanted a TCP connection with binary serialization of my objects, and I wanted a two-way communication with the server so my clients could get real-time updates via callbacks. Those options were available to me regardless of what my domain looked like.

这篇关于你是如何构建的面向网络的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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