简体   繁体   English

服务器作为Java中的客户端和服务器

[英]Server as both client and server in Java

I am a newbie to server side operations. 我是服务器端操作的新手。 I am just wondering can a Java server be a server as well as client? 我只是想知道Java服务器既可以是服务器又可以是客户端吗? Here is a scenario, Client-A connects to Server-A and requests some data from Server-A. 在这种情况下,客户端A连接到服务器A并从服务器A请求一些数据。 Server-A don't have that data but it knows Server-B has that. 服务器A没有该数据,但它知道服务器B具有该数据。 Can Server-A pull that data from Server-B and push it to Client-A. Server-A可以从Server-B提取数据并将其推送到Client-A。

Any help to understand this concept would be appreciated. 任何理解该概念的帮助将不胜感激。 Thanks in advance! 提前致谢!

"Client" and "Server" are highly context-dependant. “客户端”和“服务器”高度依赖上下文。 For example, your typical web server will probably be the "Server" on a http connection. 例如,典型的Web服务器可能是http连接上的“服务器”。 On the other hand, it will probably be the "Client" for a database, and potentially other services (such as a web service, where it acts as the client on another http connection). 另一方面,它可能是数据库以及其他服务(例如Web服务,在另一个HTTP连接上充当客户端)的“客户端”。

In your example Client A is a client for Server A and Server A is a client of Server B . 在你的例子客户A是一个client服务器A服务器A是一个client 服务器B的。

To put in other words Server A acts as a server for client A and Server B acts as a server for Server A . 换句话说, 服务器A充当客户端Aserver服务器B充当服务器Aserver

The terms server and client are used depending on the context. 根据上下文使用术语“服务器”和“客户端”。 I hope I have not confused you. 希望我不要让你感到困惑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM