View Full Version : TCP Query Port
R. Ludwig
27-08-2002, 07:27
Hi,
maybe many of you asked yourself already whats up with this ini setting. You can connect to this port using normal telnet. after
you connected u are able to use the commands shown below.
thats more for the linux guys because webinterface really has a big problem there.
this queryport is just at the beginning of development. but
the basic commands works great.
we are allready developing an php based system for this.
so you can save your time :P
TeamSpeak TCPQuery Commands:
----------------------------
there are two types of replys, ok and error. all end with an CR-LF
ok reply:
OK
error reply:
ERROR, error message
COMMANDS:
---------
ver
- prints server version
sl
- prints server list
sel serverport
- selects the server
pl [serverport]
- prints current connected clients
cl [serverport]
- prints current channel list
si [serverport]
- prints serverinfo
login username userpassword
- logs u into the server
! currently only superserveradmins can login
COMMANDS YOU HAVE TO BE LOGGED IN:
--------------------------------
addserver serverconfigname serverport
- adds a new server
- this server is selected after successfully create (no need for sel command)
stop [serverport]
- stops the server
start [serverport] <- dont works currently, so better dont stop :P
- starts the server
restart [serverport]
- restarts the server
msg [serverport] text
- sends a text message to selected server
msg all
- sends a text message to all servers
COMMANDS YOU HAVE TO BE LOGGED IN AND SELECTED AN SERVER:
------------------------------------------------------------
adduser username userpassword serveradmin superserveradmin
- adds a user to the server
- serveradmin = 0 or 1 (can only control THIS server)
- superserveradmin = 0 or 1 (that user can controll all servers)
deluser username
- deletes the user
set variable value
- possible variable names
servername
serverpassword set #CLEAR# to delete pw
serverwelcomemsg
maxuser
I'm running my server from a Windows2000 platform. I cant seem to telnet to that port, even if its local.
EDIT: all my fault, i was putting in the wrong port. works
ScratchMonkey
29-08-2002, 03:21
Not mentioned above is the "quit" command to get a clean disconnect from the server. That eliminates the need for some timeouts on the port.
Is there a problem with "sl"? I'm trying to query my clan server at Holdouts, teamspeak.matureasskickers.net. "sl" reports only the 8767 default serverport, not mine at 8772. "pl 8772" complains "serverport not found". Do I need to request a line in the INI to get my server to show in the list?
[KRIECH]Agent
29-08-2002, 09:55
I wrote this little script to test Queries using PHP.
Problem is, that I experienced the very same ugly runtime errors as when using the webinterface.
Right after the first access, the telnet-server (or whatever this is) crashes. It does not affect the TS voicechat-server.
I'm posting my script so other people may test it:
(replace xxx.xxx.xxx.xxx with your server's IP)
<?
if ($ip && $port && $cmd)
{
$cmd = "\xFF\xFF\xFF\xFF".$cmd."\x00";
$ltime=time();
$connection = fsockopen ($type.$ip, $port, &$errno, &$errstr, 1);
if (!$connection)
{
echo "Cannot connect: ($errno)-$errstr<br>";
}
else
{
echo "Connection established.<br>";
socket_set_blocking($connection,true);
socket_set_timeout($connection,0,100000);
fwrite($connection,$cmd,strlen($cmd));
echo "Request sent.<br>";
// Mark
$starttime=mktime();
do {
$serverdata.=fgetc($connection);
echo "Reply ftched ".(++$i)." times.<br>";
$serverdatalen++;
$socketstatus=socket_get_status($connection);
if ($starttime>($starttime+$waittime)) {
echo "Connection timed out";
fclose($connection);
return "";
}
} while ($socketstatus["unread_bytes"] );
fclose($connection);
echo "Reply complete; connection terminated.<br>";
echo "Result: <br><br>".$serverdata."<br>";
}
}
if (!$ip) $ip = "xxx.xxx.xxx.xxx";
if (!$port) $port = "8767";
?>
</div>
<br>
<table border="0">
<form method="POST">
<tr>
<td valign="top" class="mtext">ip:</td>
<td><input type="text" name="ip" size="15" maxlength="15" value="<? echo $ip; ?>"></td>
</tr>
<tr>
<td valign="top" class="mtext">port:</td>
<td><input type="text" name="port" size="5" maxlength="5" value="<? echo $port; ?>"></td>
</tr>
<tr>
<td valign="top" class="mtext">command:</td>
<td>
<select name="cmd">
<option>sl 8767</option>
<option>cl 8767</option>
<option>pl 8767</option>
</select>
</td>
</tr>
<tr>
<td valign="top" class="mtext">conntype:</td>
<td>
<select name="type">
<option value="udp://" selected>udp</option>
<option value="" >tcp</option>
</select>
</td>
</tr>
</table>
<tr>
<br>
<input type="submit" value="Query!">
</form>
I tried to set "server_welcomemessage" but it had no effect (checked afterwards with "si").
I tried:
set server_welcomemessage = hi
set server_welcomemessage hi
Did anyone get it to work?
Oh, and I also hat the tcp server thing crash/hang after typing some illegal commands (i could still connect but didn't get the [TS] prompt).
Using Linux server 2.0.17.17
wossName
30-08-2002, 11:09
Well it says "serverwelcomemsg" in R. Ludwig's posting, but I think I changed the value manually anyway. It's in the server.ini (do it while the server is not running...).
Fox!MURDER
01-09-2002, 01:45
This should work fine now.
<?
if ($ip && $port && $cmd)
{
if(!$server) $server='8767';
# $cmd = "\xFF\xFF\xFF\xFF".$cmd."\x00";
$cmd="sel $server\n".$cmd;
if($cmdparam) $cmd.=' '.$cmdparam;
$cmd.="\n";
$cmd.="quit\n";
$connection = fsockopen ($type.$ip, $port, &$errno, &$errstr, 1);
if (!$connection)
{
echo "Cannot connect: ($errno)-$errstr<br>";
}
else
{
echo "Connection established.<br><TABLE CELLPADDING=22 CELLSPACING=0><TR><TD BGCOLOR=#AAAAAA><TABLE><TR><TD COLSPAN=2><FONT COLOR=WHITE><H1>SERVER</H1></FONT></TR><TR><TD><H2>IP:</H2></TD><TD><H2>$ip</H2></TR><TR><TD><H2>Port:</H2></TD><TD><H2>$port</H2></TD></TR></TABLE></TD><TD><TABLE CELLPADDING=0 CELLSPACING=0>";
fputs($connection,$cmd,strlen($cmd));
echo "<TR><TD BGCOLOR=DARKRED><FONT SIZE=+5 FACE=courier ALIGN=CENTER COLOR=WHITE><=</FONT></TD><TD>".nl2br($cmd)."</TD></TR>";
$x=0;
while($serverdata = fgets($connection, 4096)) echo '<TR><TD ALIGN=CENTER BGCOLOR=DARKBLUE><FONT SIZE=+3 FACE=courier COLOR=WHITE>=></FONT></TD><TD>'.nl2br($serverdata).'</TD></TR>';
fclose($connection);
echo "</TD></TR></TABLE></TABLE>Done.<br>";
}
}
if (!$ip) $ip = "127.0.0.1";
if (!$port) $port = "8767";
?>
</div>
<br>
<table border="0">
<form method="POST">
<tr>
<td valign="top" class="mtext">ip:</td>
<td><input type="text" name="ip" size="15" maxlength="15" value="<? echo $ip; ?>"></td>
</tr>
<tr>
<td valign="top" class="mtext">port:</td>
<td><input type="text" name="port" size="5" maxlength="5" value="<? echo $port; ?>"></td>
</tr>
<tr>
<td valign="top" class="mtext">command:</td>
<td>
<select name="cmd">
<option>ver</option>
<option>si</option>
<option>si</option>
<option>cl</option>
<option>pl</option>
<option>sl</option>
<option value="">Other(use command parameter field)</option>
</select>
</td>
</tr>
<tr>
<td valign="top" class="mtext">Command parameter:</td>
<td>
<TEXTAREA name="cmdparam" COLS=80 ROWS=25> <?echo $cmdparam;?></TEXTAREA>
</td>
</tr>
<tr>
<td valign="top" class="mtext">server:</td>
<td>
<input type="text" value="<?echo $server;?>" name="server">
</td>
</tr>
<tr>
<td valign="top" class="mtext">conntype:</td>
<td>
<select name="type">
<!-- <option value="udp://" <?//if($type=="udp://") echo 'selected';?>>udp</option>-->
<option value="" <?if($type!="udp://") echo 'selected';?>>tcp</option>
</select>
</td>
</tr>
</table>
<tr>
<br>
<input type="submit" value="Query!">
</form>
<h6>Written with vim-6.1</h6>
Try it and let me know if there would be any bugs. If i would have a time ill make it a bit better.
Fox
what does the numbers before the ip in the following line mean?
1 2 11 2588 8 328 1111 55 8 8 0 4 0 0.0.0.0 sn00x q..grepped from tcpqueryport after sending pl.
R. Ludwig
03-09-2002, 19:10
Id
Channelid
pktssend
bytessend
pktsrecv
bytesrecv
pktloss
ping
LoginTime
IdleTime
ChannelPrivileges
PlayerPrivileges
PlayerFlags
ipadress
NickName
LoginName
thx, and one more question i forgot to ask:
2 3 -1 0 32000 Default
what does this numbers mean?
found out by myself now:
id
codec
type (chan or subchan)
order
maxusers
right?
pktloss is going up and down.
what does this number mean, exactly.
precentage? in the last x seconds?
Originally posted by sn00x
found out by myself now:
id
codec
type (chan or subchan)
order
maxusers
right?
i renamed type to parent.
if the value is -1 it is a main channel.
if it is greater, it's the id of the parentchannel.
order is local to the subchannel.
now i can print the same order, as seen on the client side.
but how can i change this order?
How about making portnumber arguments optional if there is ony one (default) used? Perhaps an help command would be a good thing as well.
Perhaps you could provide a setting wether the user wants it to be more machine readable or more nicely formatted.
But I'll probably not telnet from anywhere to it other than localhost, and when there is a need to remote administer the server, I'll probably use SSH and then telnet to the localhost teamspeak server.
Commands to create Channels, Edit channels, kick specific users, etc would probably be useful as well.
I'm also for some kind of input prompt such as the server port that we are currently using:
8767> pl
CONNECTION LIST
8767> help
HELP
8767> set query_output 2
0 - NONE / 1 - INTERPRETER / 2 - USER
8767> quit
any way to get the ip's of the people on a ts server (and kick/ban them) through this protocol? i'm working on a "clan management" package so that if someone is banned from a gameserver, they're also banned from that clan's ts server, web page, etc.
Oh, and any plans to allow plain old serveradmins to login?
Thanks,
Todd
Dummer Sack
11-01-2004, 21:17
If you are server admin, just right cklick on a user and look in the connection info. There you will see their IP.
Also the IP is shown in the TCPQueryPort command pl.
And plain old (TS) serveradmins can log in at the TCPQueryPort (eg: sel 8767, login name pass), Web Interface and via the TS Client. Or do you mean something else?
Thanks for the response,
Here's what I mean: Our clan rents a TS server from some company. There are several TS servers running on that same box. From my understanding, only the company that we rent from can login through the TCP query port, not our clan's admins. Is that correct, or no?
Thanks,
Togg
Dummer Sack
12-01-2004, 15:59
If they have the TCPQueryPort public accessible (not blocked by a firewall or something) then anyone can connect and use it.
Of cause you can do the most commands only on your server and have to authenticate before. The only commands not available to you are the ones that have super admin requirements.
So it is up to the hosting company if you can use the TCPQueryPort.
Example (Lets say your server runs on port 8767):
sel 8767
login admin xxxx
pl
That will give you a list of the players.
(pl works without login but the IPs are only shown if you login as an admin first).
so can admins see the ip's? or just super admins?
Thanks,
Togg
SatanClaus
12-01-2004, 17:31
normally this should work for server-admins as well, yes.
(pl gives you a playerlist of currently connected clients including a column of all ips)
cu
SatanClaus
Hi,
.......
COMMANDS YOU HAVE TO BE LOGGED IN:
..........
...
...
restart [serverport]
- restarts the server
.....
...
..
:confused: But such command don's exists (may be in my version - 2.0.20.1 Win32 FreeWare)!!
Is it error or is really exists??
It doesn't exist yet or anymore, but you can use serverstop and serverstart in succession to replace that command.
It doesn't exist yet or anymore, but you can use serverstop and serverstart in succession to replace that command.
:cool:
.. .but then a message like "Server shut down" will appear....
may be is it possible to don't show this window anyway?
[D[F]S]PistolGr
15-06-2004, 11:09
How about switching channels. Is there a command to switch a user from one channel to another using the telnet or php interface?
[D[F]S]PistolGr
15-06-2004, 13:34
Yes, it's called "mptc".
mptc, cool. Not in Ludwig's list, in the help, or anywhere else on the forums, can you clue us in on the rest of the syntax to use the command.
Connect to the TCP Query Port, type "help mptc".
move player to channel
wow, great :cool:
[D[F]S]PistolGr
15-06-2004, 15:14
Connect to the TCP Query Port, type "help mptc".Very helpful. Give a man a fish and you fed him for a day... teach a man fish and you've fed him for life.
help mptc
Name
mptc - move a player to a channel
Usage
mptc <channelID> <playerID>
Moves the user with the <playerID> to the channel specified in <channelID>. Works like the "drag & drop" functionality of the client, so it basicly overrules passwords, userlimits and sticky flags.
Thanks mouse.
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.