Author |
Message |
Half Guest
Offline
|
Posted: Fri Mar 31, 2006 9:17 pm Post subject: Is it possible to connect to SS via PHP? |
|
|
|
|
If so, can anyone give me a quick insight on how it would be done? |
|
Back to top |
|
|
CypherJF I gargle nitroglycerin
Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Fri Mar 31, 2006 9:22 pm Post subject: |
|
|
|
|
Possible, maybe. Unlikely, yes. _________________ Performance is often the art of cheating carefully. - James Gosling |
|
Back to top |
|
|
Half Guest
Offline
|
Posted: Fri Mar 31, 2006 10:19 pm Post subject: |
|
|
|
|
I don't mean a continuous connection, but like connect then check messages maybe, or get a player count for a zone, or check for available squads/names. This seems feasible to me but I don't know the method of how it would be done. |
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Fri Mar 31, 2006 11:08 pm Post subject: |
|
|
|
|
Possible in the same way that the sun could explode tomorrow. It could happen, but it probably wont. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
|
Half Guest
Offline
|
Posted: Fri Mar 31, 2006 11:21 pm Post subject: |
|
|
|
|
You guys are amazingly helpful |
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Fri Mar 31, 2006 11:27 pm Post subject: |
|
|
|
|
PHP has Sockets which will let you connect with UDP. Just look at the source for some bot cores or on the Wiki for packet information. You can check player counts for a zone just by using the Ping Protocol which will tell you the current ping to a zone and the player count, just like on the main menu of Continuum.
Actually logging into a zone to do messaging is a lot more complex, and you'd need to look through a bot core for how to do that. |
|
Back to top |
|
|
Half Guest
Offline
|
Posted: Fri Mar 31, 2006 11:36 pm Post subject: |
|
|
|
|
t.y. MGB, I'll give it a look |
|
Back to top |
|
|
BDwinsAlt Agurus's Posse
Age:33 Gender: Joined: Jun 16 2003 Posts: 1145 Location: Alabama Offline
|
Posted: Sat Apr 01, 2006 12:28 am Post subject: |
|
|
|
|
I have seen a Java Applet connect to an ASSS zone before. Maybe Java would be the way for you to go. It works a lot better and is easier for situations like this. TWCore and Hybrid are bot cores written in Java. So we know it will work. |
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Sat Apr 01, 2006 12:37 am Post subject: |
|
|
|
|
BDwinsAlt wrote: | TWCore and Hybrid are bot cores written in Java. So we know it will work. |
Any language with sockets will work with Subspace. Its not like you are trying to mount a Ford motor in a VW Bug. |
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Sat Apr 01, 2006 6:20 am Post subject: |
|
|
|
|
I think for the java thing to work, the applet and zone must be on the same server. _________________ ss news |
|
Back to top |
|
|
Maverick
Age:39 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
|
Back to top |
|
|
a dead fish Newbie
Age:57 Gender: Joined: Jan 13 2006 Posts: 3 Location: Hernando, FL Offline
|
Posted: Sat Apr 01, 2006 12:04 pm Post subject: |
|
|
|
|
Mine GO BOOM wrote: | [..]
Any language with sockets will work with Subspace. Its not like you are trying to mount a Ford motor in a VW Bug. |
ehhe, where there's a will, there's a way...
http://britishv8.org/swaps/vwv8ford.htm
|
|
Back to top |
|
|
k0zy Server Help Squatter
Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Sat Apr 22, 2006 10:49 pm Post subject: |
|
|
|
|
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: | Checks the current population of SSCU 17th Parallel |
Might as well check the ping while you are at it, as it requires so little code. |
|
Back to top |
|
|
D1st0rt Miss Directed Wannabe
Age:36 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Sat Apr 22, 2006 11:40 pm Post subject: |
|
|
|
|
I think I recall Cypher had something that connected to a bot over PHP for viewing chat or something like that _________________
|
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Sat Apr 22, 2006 11:58 pm Post subject: |
|
|
|
|
Mine GO BOOM wrote: | [..]
Might as well check the ping while you are at it, as it requires so little code. |
Very few people care about the ping between the web server and the zone. |
|
Back to top |
|
|
k0zy Server Help Squatter
Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Sun Apr 23, 2006 11:33 am Post subject: |
|
|
|
|
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: | Despite of what Dr. Brain said, could someone add the ping code? |
First problem is that time() only returns seconds. Need to create a 32bit timestamp with milliseconds (or if you want, could even go higher as microtime on unix gets pretty damn small). I know this works on unix, didn't test on windows. The bitwise AND keeps the number unsigned at least, but doesn't account for roll overs. So a better get_ms() function could be created.
<?php
function get_ms()
{
list($msec, $sec) = explode(" ", microtime());
return round(($sec + $msec) * 1000) & 0x7FFFFFFF;
}
$host = "66.36.241.110";
$port = 5901;
$fp = fsockopen("udp://".$host, $port);
fwrite($fp, pack("V", get_ms()), 4);
$total = fread($fp, 4);
$timestamp = fread($fp, 4);
fclose($fp);
$population = array_pop(unpack("V", $total));
$ping = get_ms() - array_pop(unpack("V", $timestamp));
echo "Population: " . $population . "<br>\n";
echo "Ping: " . $ping . " ms<br>\n";
?> |
|
|
Back to top |
|
|
k0zy Server Help Squatter
Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Sun Apr 23, 2006 11:54 am Post subject: |
|
|
|
|
Using the timestamp that the server sent back has no real advantage in such a small script, hasn't it?
The only advantage I see is when you ping multiple zones at once?
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... |
|
Back to top |
|
|
Mine GO BOOM Hunch Hunch What What
Age:40 Gender: Joined: Aug 01 2002 Posts: 3614 Location: Las Vegas Offline
|
Posted: Sun Apr 23, 2006 1:35 pm Post subject: |
|
|
|
|
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: | Using the timestamp that the server sent back has no real advantage in such a small script, hasn't it?
The only advantage I see is when you ping multiple zones at once? |
Correct. The above code would work fine if you set the socket to non-blocking and just have a timeout wait of a second or two. Technically, you should remember the timestamp you send out, so you know that the packet you got back was the last one you sent and not a previous one. |
|
Back to top |
|
|
Donkano Server Help Squatter
Gender: Joined: Jul 02 2003 Posts: 763 Offline
|
Posted: Sun Apr 23, 2006 1:39 pm Post subject: |
|
|
|
|
MGB, that script does work on Windows. Tested it on a Windows 2003 Server computer.
I tried targetting it on SSDV Into the moat and STFU Anything Goes and both timed out. Do you know why? |
|
Back to top |
|
|
k0zy Server Help Squatter
Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Sun Apr 23, 2006 2:18 pm Post subject: |
|
|
|
|
Donkano wrote: | MGB, that script does work on Windows. Tested it on a Windows 2003 Server computer.
I tried targetting it on SSDV Into the moat and STFU Anything Goes and both timed out. Do you know why? |
Works fine on WinXP.
Make sure you have the port increased by one.
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... |
|
Back to top |
|
|
Donkano Server Help Squatter
Gender: Joined: Jul 02 2003 Posts: 763 Offline
|
Posted: Sun Apr 23, 2006 3:23 pm Post subject: |
|
|
|
|
Here is something that I would like to see done:
PHP does the following:
Connects to a directory server.
Finds all zones starting with with a specific string (to target networks/groups)
Lists all those zones with their IP/Port, ping and population
Would look something like this for output:
SSDV Into the moat
- IP: 69.93.119.226
- Port: 3000
- Population: 4
- Ping: 90ms
If anyone has the time for this, I would appreciate it. I would like to put it on the SSDV website so that it can display zone information. |
|
Back to top |
|
|
k0zy Server Help Squatter
Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Mon Apr 24, 2006 3:16 am Post subject: |
|
|
|
|
Donkano wrote: | Here is something that I would like to see done:
PHP does the following:
Connects to a directory server.
Finds all zones starting with with a specific string (to target networks/groups)
Lists all those zones with their IP/Port, ping and population
Would look something like this for output:
SSDV Into the moat
- IP: 69.93.119.226
- Port: 3000
- Population: 4
- Ping: 90ms
If anyone has the time for this, I would appreciate it. I would like to put it on the SSDV website so that it can display zone information. |
I could try... I have no experience with sockets, packets and protocols though (except what's been posted in this thread)
But this should be a good variety to all the programming tasks at university.
Is http://wiki.minegoboom.com/index.php/Directory_Client_Protocol the only information available about the protocol?
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... |
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Mon Apr 24, 2006 3:23 am Post subject: |
|
|
|
|
Donkano wrote: | Here is something that I would like to see done:
PHP does the following:
Connects to a directory server. | I don't think that's a good idea. There's only one dirserv and a webpage that talks to it could easily be abused. |
|
Back to top |
|
|
|