简体   繁体   English

使用本地端口从网站发送TCP / IP请求

[英]Sending TCP/IP request from website using local port

I want to create a web utility which will use a local port for sending a TCP/IP request. 我想创建一个Web实用程序,它将使用本地端口发送TCP / IP请求。

Does it possible to use a client side port to send a TCP/IP request? 是否可以使用客户端端口发送TCP / IP请求?

I know it is possible if we send a TCP/IP request from a web server and the specific port is allowed on server. 我知道,如果我们从Web服务器发送TCP / IP请求并且服务器上允许使用特定端口,则是可能的。 But I want to send the request using the client side port. 但是我想使用客户端端口发送请求。

What would I need to do? 我该怎么办? Should I create a Java Applet/Plugin or is it possible using PHP/.net? 我应该创建Java Applet /插件还是可以使用PHP / .net?

It depends what you want to do, but fundamentally you can't initiate operations on the client using server side code like PHP. 这取决于您要执行的操作,但是从根本上讲,您无法使用服务器端代码(如PHP)在客户端上启动操作。

Javascript is capable of some networking operations using XHR (Ajax) and WebSockets , and wrapping libraries such as socket.io . Javascript能够使用XHR(Ajax)和WebSockets进行某些联网操作,并包装诸如socket.io之类的库。 Perhaps that will suffice for your needs. 也许这足以满足您的需求。

A Java Applet will be more capable, but will be restricted in what it can do unless you sign the code. Java Applet将更加强大,但是除非您对代码签名,否则它将受到限制 And of course will be slower to start up for the client. 当然,对于客户端来说,启动起来会比较慢。

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

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