如何最好地实现服务器端应用程序? [英] How to best implement a server side app?

查看:82
本文介绍了如何最好地实现服务器端应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想编写一个通过互联网与PC通讯的移动设备应用程序.为了使它正常工作,我需要一个服务器端应用程序,移动应用程序和PC应用程序都可以通过套接字连接到它(这是另一个故事).服务器端应用程序会将来自移动设备的消息分发到PC,反之亦然.我的问题是:实现服务器端应用程序的最佳方法是什么? (可以是c#或Java).我可以使用C#,但我不知道我的应用程序应采用哪种形式. Windows服务?还是Java小程序?我也不知道这两个在维护和控制部分可以带来什么优势.请帮忙! :)

Hy guys,

I want to write a mobile device app that communicates with a PC over the internet. In order for this to work i need a server side application that both the mobile app and the PC app can connect to via sockets (why this is so it''s another story). The server side app will dispatch messages that come from the mobile device to the PC and the other way around. My question is: what is the best way to implement the server side app? (It can be c# or Java). I can go with C# but i don''t know what form should my app take. A windows service? Or a Java applet? I''m also clueless about what advantages these 2 can bring in the maintenance and control part. Please Help! :)

推荐答案

尽管我不是专家,但我会提出意见.我从来都不缺这些.我喜欢Windows服务方法,而不是Java applet方法.我的经验是Java小应用程序对事件的响应往往很慢,并且总体上不太可靠.

Windows服务可以由主​​机管理员控制,可以在启动时自动运行(如果选择以这种方式配置),并且可以在事件查看器中记录活动. C#程序也相当快,并且也可以变得相当高效.

从结构上讲,我将其设计为一个基本应用程序,其中包含两个工作线程来监视移动套接字和PC套接字的请求.当任一线程检测到操作请求时,该请求都会传递到主机应用程序以进行服务.

我正在尝试构建类似的东西,尽管使用的是嵌入式处理器而不是Windows服务器,这是我计划实现的方法.

只是我的
Although I''m no expert in this, I''ll throw in an opinion; I''m never short of those. I like the Windows service approach, rather than the Java applet method. My experience is that Java applets tend to be slow to respond to events, and rather unreliable in general.

A Windows service can be controlled by the host administrator, runs automatically on startup (if you choose to configure it that way), and can log activities in the Event Viewer. C# programs are also rather fast, and can be made quite efficient, as well.

Structurally, I''d design it as a base app hosting two worker threads to monitor the mobile socket and the PC socket for requests. When either thread detects a request for action, this is passed to the host app for service.

I''m trying to build something similar, though using an embedded processor rather than a Windows server, and this is the approach I plan to implement.

Just my


0.02值得...
0.02 worth...


这篇关于如何最好地实现服务器端应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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