开发者

Using java applet to send request with the client ip

i need to send a request to开发者_开发知识库 a website when a user submits their url, i tried using curl but it uses server ip which i dont want i have seen a website that is doing a similar job by using applet, users need to open a popup which contains the applet after they leave it open allow it to run it uses a port and then uses the localhost ip like so 127.0.0.1:64653 to send request and basicly curl by the user ip. i decompiled the applet the website was using and they were using java.net.ServerSocket and some other java code but i do not know anything about java. I would to know how this can be done.


I think you are really confused.

  1. a user does not have a URL.

  2. there is a IP address that represents the browser end of the connection to the web server he/she is connected to (actually, there could be more than one) but this does not allow something else to establish a connection to the browser. So it is not a URL.

  3. the IP address + port number that the browser has are transient. In 2 minutes time, the very same IP/port could denote a different user, possibly even on a different machine.

  4. 127.0.0.1 is a "special" IP address that says "this machine". It cannot be used for communication with another machine.

  5. notwithstanding all of the above, web browsers do not accept incoming HTTP connections from web servers or anything else. The HTTP protocol (which is what the web works on) distinguishes between the roles of "client" and "server", and specifies that a client connects to a server and not the other way round. A web browser is always an HTTP client, by convention and also for security reasons.

So when you say ...

i need to send a request to a website when a user submits their url

... it simply does not make any sense. Please explain what you are tying to achieve ... not how you are trying to achieve it ... and we might be able to help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜