简体   繁体   English

如果用户端口80繁忙,是否可以进行重定向?

[英]is it possible to make redirection if user's port 80 is busy?

I have a java application that runs on some server. 我有一个在某些服务器上运行的Java应用程序。

When user accesses this application, it needs to check if port 80 on user's machine is available. 当用户访问此应用程序时,它需要检查用户计算机上的端口80是否可用。 Based on the status, it will make some redirection. 根据状态,它将进行一些重定向。

My question... is it possible to check from java code if port 80 is busy on the user's machine? 我的问题...是否可以从Java代码检查用户计算机上的端口80是否繁忙?

There's no reliable method to check if a remote port is busy. 没有可靠的方法来检查远程端口是否繁忙。 Such behaviour will be a security breach. 这种行为将构成安全漏洞。 However, you can check if an HTTP resource is reachable just by requesting it. 但是,仅通过请求即可检查HTTP资源是否可访问。 If unknown, server is supposed to return a 404 HTTP code. 如果未知,则服务器应返回404 HTTP代码。

However for local port, just try to open a server listening to this port using a ServerSocket 但是对于本地端口,只需尝试使用ServerSocket打开侦听此端口的服务器

您无需检查用户计算机上的端口。该端口与URL结合使用。如果应用程序已在服务器上启动,则用户可能需要检查其是否能够访问服务器URL和端口。端口在计算机上打开(当然,除非服务器在您自己的本地计算机中)。您需要做的只是检查防火墙或网络问题,以便可以访问服务器。

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

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