作者PsMonkey (痞子军团团长)
看板java
标题Re: [问题] 如何在网页上用Applet显示使用者ip
时间Mon Jan 28 18:44:08 2013
※ 引述《vincewen (Zafe)》之铭言:
: 小弟最近在研究JAVA网路相关的一些内容
: 利用InetAddress myaddress = InetAddress.getLocalHost();
: 在自己电脑跑(cmd或JFrame)可以成功取出电脑的IP
: 想说改写成applet的方式,但是最後显示出来只有localhost 127.0.0.1
: 不论至丢上上传空间或直接用电脑开都一样
: 请问是否可以请高手帮忙指点一下症结点 以及要如何解决
: 上网有找到我想要做出的功能的网页 但似乎不提供原始码
: http://reglos.de/myaddress/MyAddress.html
: 感谢回答^^
http://docs.oracle.com/javase/1.4.2/docs/
api/java/net/InetAddress.html
#getLocalHost()
Returns the local host.
If there is a
security manager,
its checkConnect method is called with the local host name and
-1 as its arguments to see if the operation is allowed.
If the operation is not allowed,
an InetAddress representing the loopback address is returned.
我没有实际测试过,不过看到这段文字
我至少会先把 applet 给 sign 过试试看
如果还是不行,那我会在文章当中告诉大家我已经 sign 过了
--
钱锺书:
说出来的话
http://www.psmonkey.org
比不上不说出来的话
Java 版 cookcomic 版
只影射着说不出来的话
and more......
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.135.202.140
1F:推 vincewen:谢谢大大的指点! 小弟下次会改进~ 01/28 20:09
2F:推 supercygnus:monkey!! monkey!! hi!! hi!! monkey!! 01/28 21:00
3F:推 antihiv:还好我现在都不屑在这里发文,爽!! 01/29 00:22
4F:推 antihiv:在某个版发真是友善多了,java版真是一堆老鼠屎坏了一锅粥 01/29 00:25
5F:→ PsMonkey:==" 这篇文章根本没半点酸意也能藉机被酸... 01/29 00:35
6F:→ PsMonkey:还是世道已经沦落到不先看 API 也可以问 API 有的东西? 01/29 00:37
7F:推 vincewen:其实我主要是想问的是 它是怎麽做到可以直接秀出IP的 01/29 01:10
8F:→ vincewen:因为我其实上网找了一段时间 但都没有办法达成那个效果 01/29 01:13
9F:→ Lordaeron:signed applet and then by OS with its command 01/29 11:16
10F:→ Lordaeron:and then fetch the result of command 01/29 11:18
11F:推 LaPass:我怎麽看到过有书上写.... JVM叫command会比自己写JAVA镶在 01/29 16:06
12F:→ LaPass:程式里面还耗资原的样子.... 01/29 16:11
13F:→ Lordaeron:哦, 用JAVA 就够耗资原的了!! 还是好好的写ASSEMBLY 吧 01/29 22:04