关于使用Delphi 2010编写TCP IP消息系统(客户端/服务器)的建议 [英] Suggestions on writing a TCP IP messaging system (Client/Server) using Delphi 2010

查看:185
本文介绍了关于使用Delphi 2010编写TCP IP消息系统(客户端/服务器)的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Delphi 2010中编写一个使用TCP IP的消息系统。我想听听使用标准delphi 2010组件/ Indy组件执行此操作的最佳选择。

I would like to write a messaging system using TCP IP in Delphi 2010. I would like to hear what my best options are for using the standard delphi 2010 components/indy components for doing this.

我想编写一个服务器,用于侦听和转发消息到运行客户端的网络上的所有计算机。

I would like to write a server which does the listening and forwarding of messages to all machines on the network running a client.

1。) a。)客户端可以将消息发送到服务器,然后转发给所有其他客户端
b。)客户端(通过服务器)侦听其他发件人的消息并显示消息。

1.) a.) clients can send a message to server to be forwarded to all other clients b.) clients listen for messages from other senders (via server) and displays messages.

2。)a。)服务器可以向所有客户端
发送消息b。)服务器将来自客户端的所有消息转发给所有其他客户端

2.) a.) Server can send a message to all clients b.) Server forwards any messages from clients to all other clients

感谢您的任何建议

注意:我不是在编写即时消息或聊天程序。这仅仅是一个系统,用户可以向其他用户发送警报/消息-他们不能互相回复!没有商业,共享软件等链接-请!我想听听您将如何编写这种类型的系统,将采用何种方法以及可能使用的TCP IP消息体系结构。

NOTE: I am not writing a instant messaging or chat program. This is merely a system where users can send alerts/messages to other users - they can not reply to each other! NO commercial, shareware, etc links - please! I would like to hear about how you would go about writing this type of system and what approachs you would take, and possibly the TCP IP messaging architecture you would use. Whether it be straight Winows API, Indy components, etc, etc.

推荐答案

如果这仅是Windows,而您不是这样的话,则可以直接使用Winows API,Indy组件等。要使用第三方库,则可以跳过TCP / IP,然后使用邮筒

If this is Windows only, and you don't want to use 3rd party libraries, then you can skip TCP/IP and go for Mailslots.

编辑:如果您希望保证交付,比命名管道是一个更好的解决方案。 此SO问题有一个很少不错的答案以Delphi命名为管道示例。

Edit: if you want guaranteed delivery, than named pipes is a better solution. This SO question has a few nice answers with Delphi named pipe examples.


mailslot 是一种单向
进程间通信(IPC)的机制。
应用程序可以将消息存储在
邮槽中。邮槽
的所有者可以检索在那里存储
的邮件。这些消息通常是
通过网络发送到
指定的计算机或指定域中的所有计算机
。域是
个由
共享一个组名的工作站和服务器组成的组

他们不需要Windows域,它们通过LAN工作。

They don't need a Windows domain, they work over a LAN.

DelphiPages 有一个很好的在进行IPC时会失败在德尔福中,包括邮筒。

DelphiPages has a nice run-down on doing IPC in Delphi, including mailslots.

-jeroen

这篇关于关于使用Delphi 2010编写TCP IP消息系统(客户端/服务器)的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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