EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Misc::Off Topic (https://www.eqemulator.org/forums/forumdisplay.php?f=595)
-   -   Unable to Connect Via Telnet with PHP (https://www.eqemulator.org/forums/showthread.php?t=25878)

trevius 08-05-2008 10:38 PM

Unable to Connect Via Telnet with PHP
 
I am trying to get some tools working for my server that need direct telnet access to the server on port 9000 to use them. I have tried all I can think of to get this working. My PHP skills are pretty weak, so maybe I am doing something wrong. The only other thing I can think of is that the web hosting I am using to connect to the server remotely might be blocking port 9000. Though, I don't know why it would block that port.

Once I can verify that the connection is able to work, I can get the rest setup without much difficulty (I hope). For now, all I am trying to do is verify that I can get connected to the server, so this is a pretty basic file.

index.php
Code:

<?php

$Server='my.dyndns.com';  //of course my real dyndns address has been replaced here for the post
$Port='9000';
$user='username'; //username of my GM account on the server
$pass='password'; //password that I have in my accounts table for my GM account

$url = 'http://stormhavenserver.com/'; //this will eventually point back to the tool

$fp = fsockopen($Server, $Port);
$end = "<a href=$url>Go back to the Tool</a>";

function fConnect($fp,$Server,$Port,$user,$pass){
        if(!$fp){
        echo ("Error connecting host...");
        }else{
                fputs ($fp, "$user\r");
                echo("Login Accepted\r<br>");
                usleep(125000); 
                      fputs ($fp, "$pass\r");
                usleep(125000);
                echo("Password Accepted\r<br>");
        }
}

?>

Here is the error I get when I try to go to index.php (of course my.dns.com in this output was replaced so it doesn't show my real address):
Code:

Warning: fsockopen() [function.fsockopen]: unable to connect to my.dyndns.com:9000 (Connection timed out) in /home/stormhav/public_html/tools/status/index.php on line 3
()

If anyone has any ideas what could be wrong, I would love to get this working. I have been messing with it for a few hours and just can't figure it out :(

trevius 08-11-2008 06:12 PM

I am still unable to figure out why this isn't working. I have even tried setting up the EQEmu Portal Tool on my web site, but it doesn't seem to work for telneting to the server. I would like to avoid having to run the tools I want directly on the server and would rather have my website run the tools and just have it connect to the server remotely.

Here is the Portal Tool I was trying to use to test if it could connect remotely:

EQEmuPortal
http://www.eqemulator.net/forums/showthread.php?t=19202

I have tried telneting to the server from webmin by telneting the to dyndns url and that works fine, so I assume that means that I am not blocking the connection coming into the server through my router. So, the only other thing I can think of is that the port 9000 is being block from leaving my web hosting, but I have no clue why they would do that...

Still looking for help if anyone has any ideas to get this working.

Angelox 08-11-2008 08:48 PM

I've had a friends not be able to find me right after my dynamic ip gets reset. For example, Windows is set to cache dns names for around a day. So If your server ip changes, the old IP stays in the cache. Right-click on the network Icon and 'repair connection' will clear the cache. Probably not the problem, but good to know.
Also try the 'DMZ Host IP Address' option with your router and server - I've had problems with router ports and Linux before- DMZ opens everything to one PC in the LAN.

trevius 08-12-2008 06:06 PM

Getting to my server isn't an issue. I can connect to the EQEmu admin tool just fine. The problem is trying to get my website to connect to the server via telnet to be able to use the functions available there.

I will have to mess with router settings I guess and see if that helps. I was thinking of trying to use Port Triggering to change port 23 to 9000. That way, if port 9000 is being blocked by the web host I am using for whatever reason, I can just use port 23 and have it convert to port 9000 when it hits my router.

Angelox 08-12-2008 08:12 PM

If you want to eliminate any doubts about the router, put it in DMZ mode for a while, if there's no difference when you do, then it won't be the router.

trevius 08-13-2008 04:34 AM

Well, as I thought, setting it as a DMZ had no effect. I already have port 9000 opened, cause that is what the emulator uses, and that is the port I have to use to telnet into the server.

From another pc on my LAN, I am able to telnet to my server using "telnet my.dyndnsname.com 9000", but it doesn't work if I use "telnet my.dyndnsname.com:9000". I have also tried replacing the URL with my actual internet IP, but it still doesn't make any difference.

kedra 01-23-2009 01:57 PM

Your code seems to work fine for me.

I replaced your address and credentials with my own and added a call to that function and it spits out a success message. So maybe the problem your host?


All times are GMT -4. The time now is 02:52 AM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.