简体   繁体   English

如何使应用程序发送不知道接收方应用程序IP地址的消息?

[英]How can i make an application to send messages not knowing the ip address of the receiver application?

I've got 3 programs, 我有3个程序

  1. A client which sends a file, 客户端发送文件,
  2. A web application which receives the file and sends messages, and 一个Web应用程序,它接收文件并发送消息,并且
  3. A GUI which receives the messages from the web application. 从Web应用程序接收消息的GUI。

The web application doesn't know the IP address of the GUI, so i suppose it will send the message to a port. Web应用程序不知道GUI的IP地址,因此我想它将把消息发送到端口。 The GUI knows the IP address of the web application and the port and listens all the time for incoming messages. GUI知道Web应用程序的IP地址和端口,并始终侦听传入消息。
I tried to make the GUI client and the web application client but without success. 我试图制作GUI客户端和Web应用程序客户端,但是没有成功。 Any suggestions how can i make the GUI program to listen for messages and the web application to send messages? 有什么建议可以使GUI程序侦听消息并通过Web应用程序发送消息吗? I would really appreciate if you paste me some code because I'm new in programming. 如果您粘贴一些代码,我将不胜感激,因为我是编程新手。
Thanks. 谢谢。

If the GUI knows the address of the web application, but not vice versa, then it's the web application that should listen for connections. 如果GUI知道Web应用程序的地址,反之则不然,则应由Web应用程序监听连接。 When the GUI starts, it should connect to the web application. GUI启动时,它应连接到Web应用程序。 The web application should receive this connection, remember it, and allow several connections at once (several GUIs running at the same time). Web应用程序应该接收此连接,记住该连接,并一次允许多个连接(多个GUI同时运行)。 Whenever there's somthing to report, the web application should report to all the connections it has remembered, and if there's any error sending the message, close and forget exactly the single connection that caused the error. 每当有什么要报告的内容时,Web应用程序都应该向它记住的所有连接报告,并且如果在发送消息时出现任何错误,请关闭并完全忘记引起错误的单个连接。

But to be honest, if you're serious about 但说实话,如果您是认真的

paste me some code because i am new in programming

then you shouldn't be starting with client/server software and inter-process communication. 那么您不应该从客户端/服务器软件和进程间通信开始。

暂无
暂无

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

相关问题 如何让服务器的外部 IP 地址可以访问 Spring Boot 应用程序? - How to make Spring Boot application accessible by external IP address of the server? 如何使客户端服务器Java应用程序在一个端口上发送消息,而在另一个端口上接收消息? - How do I make a client-server Java application to send messages on one port but receive them on another? 如何从Java Web应用程序跟踪用户的IP地址和Windows登录名 - How can i trace the users IP address and Windows Login name from a java web application 如何在我们使用 springboot 的 Rest API 应用程序中将域或 IP 地址列入白名单? - How can I whitelist Domain or IP address in a Rest API application in which we are using springboot? 如何将简单的消息从网页(HTML / Javascript)发送到Java应用程序? - How can I send simple messages from a webpage (HTML/Javascript) to a Java application? 如何仅使用局域网内的 IP 地址发送消息 - how to send messages using only IP address within LAN 如何将图像从Java应用程序发送到Android应用程序? - How can I send an Image from a Java application to an Android application? 如何确保我的应用程序使用的是代理服务器而不是硒中的IP地址? - How to make sure that my application is using Proxy server and not my IP address in selenium? 如何将消息从Win32应用程序发送到Java SWT应用程序? - How do I send messages from Win32 application to Java SWT application? 如何将Android应用程序中的地址发送到Google地图 - How to send address in Android Application to Google Maps
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM