我已经设置了一个本地的“我的世界”服务器。我决定得到我自己的领域,因为我不太漂亮。问题是,因为我的路由器的ip地址每晚都在变化,所以我不能对我的ip地址做一个A记录。相反,我需要一个动态dns提供程序,它允许我使用我自己的域。我似乎找不到一个,所以我自己用php编码(我有一个带有静态ip地址的免费web服务器)。下面是..php文件的代码:
<?
$usernameTest = $_GET["username"];
$passTest = $_GET["pass"];
$ipaddr = $_GET["ipaddr"];
$username = "USERNAME";
$pass = "*****";
$port = ":25565";
$serverIPtxt = "serverIP.txt";
if(file_exists($serverIPtxt)) {
if($usernameTest == $username) {
if($passTest == $pass) {
$a = fopen("$serverIPtxt", "w");
fwrite($a, $ipaddr);
fclose($a);
echo $ipaddr;
}
} else {
$a = fopen("$serverIPtxt", "r+");
$dynIP = fread($a, filesize($serverIPtxt));
fclose($a);
$url="http://".$dynIP."".$port;
header("Location: $url", true);
die();
}
}
?>我的路由器是自动应用正确的ip地址,所以在理论上,我应该能够连接到我的新领域的我的服务器,但我不能。相反,“我的世界”给了我这个错误:
[13:52:38] [Client thread/INFO]: Connecting to DOMAIN, 25565
[13:52:39] [Server Connector #5/ERROR]: Couldn't connect to server
java.net.ConnectException: Connection refused: no further information: DOMAIN/IPADDRESS:25565
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[?:1.8.0_25]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716) ~[?:1.8.0_25]
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:208) ~[NioSocketChannel.class:4.0.23.Final]
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:287) ~[AbstractNioChannel$AbstractNioUnsafe.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528) ~[NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) ~[NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) ~[NioEventLoop.class:4.0.23.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) ~[NioEventLoop.class:4.0.23.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) ~[SingleThreadEventExecutor$2.class:4.0.23.Final]
at java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_25]我做错了什么?还是“我的世界”只是不支持php重定向?
发布于 2016-06-18 13:30:09
我的世界不使用HTTP!它使用基于TCP的自己的协议。
我在过去使用过的最佳选择是运行动态ip更新程序客户端。
myname.ddns.net)myname.ddns.net ( NoIP域名)。myname.com)。这将通过CNAME记录将客户端引用到myname.ddns.net,而CNAME记录又将您的动态IP (例如xxx.xxx.xxx.xxx)称为A记录。在此之后,您将能够连接到您的服务器与您的自定义域和动态更新将保持动态IP自动更新。
https://stackoverflow.com/questions/37896828
复制相似问题