Solved Port range for creating server

Status
Not open for further replies.

FromLondon

Honk Honk
TeamSpeak Developer
VIP
May 20, 2016
264
107
136
Hi. :cool:
I`m writing a public server creation srcipt for the self experience and fun)


We creating server, variables are predefined.
I want limit count of servers (on ports). Have a problem.
First server with port=$port creating succesfull, but when creating the second server i`m getting error.
Fatal error: Uncaught exception 'TeamSpeak3_Adapter_ServerQuery_Exception' with message 'unable to bind network port'
How to solv this ?
PHP:
    $connect = TeamSpeak3::factory("serverquery://$serveradmin:$pass@$server[0]:$server[1]/");
    $new_sid = $connect->serverCreate(array(
 "virtualserver_name" => $servername,
 "virtualserver_maxclients" => $slots,
 "virtualserver_hostmessage" => $hostessage,
 "virtualserver_welcomemessage" => $message,
 "virtualserver_port" => $minport,
 "virtualserver_hostmessage_mode" => $hostmessagemode,
 "virtualserver_hostbutton_gfx_url" => $hostbuttongfx,
 "virtualserver_hostbutton_url" => $hostbuttonlink,
 "virtualserver_hostbutton_tooltip" => $hostbuttontooltip,
 "virtualserver_download_quota" => $downloadquota,
 "virtualserver_upload_quota" => $uploadquota,
));
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
Write the last port to a file or a database and just add 1 to it before creating a server or just check the port of the last server and add 1 to it. Shouldn't be that hard.
 

FromLondon

Honk Honk
TeamSpeak Developer
VIP
May 20, 2016
264
107
136
realize through a framework is possible?
 

Norvik

Retired Staff
Contributor
Jul 18, 2015
635
588
157
realize through a framework is possible?
What? As I said just read the the documentation of the framework and it will teach you how to get information about a virtual server. If you are too lazy or too retarded just save and read the last port to a file or a database.
 

daffik1

Member
Feb 19, 2016
23
2
50
"virtualserver_port" => $minport, -> Delete this, create server without it and add
$port = $new_sid['virtualserver_port']; to show port use echo $port;
 

FromLondon

Honk Honk
TeamSpeak Developer
VIP
May 20, 2016
264
107
136
"virtualserver_port" => $minport, -> Delete this, create server without it and add
$port = $new_sid['virtualserver_port']; to show port use echo $port;
This is not what I need)
I solve this)
 
Status
Not open for further replies.
Top