2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-03-16 23:01:02 +01:00
<class name= "TCP_Server" inherits= "Reference" version= "3.5" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-12 22:42:36 +02:00
<brief_description >
2019-06-22 01:04:47 +02:00
A TCP server.
2017-09-12 22:42:36 +02:00
</brief_description>
<description >
2019-06-22 01:04:47 +02:00
A TCP server. Listens to connections on a port and returns a [StreamPeerTCP] when it gets an incoming connection.
2017-09-12 22:42:36 +02:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "is_connection_available" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
2017-09-12 22:42:36 +02:00
<description >
2019-05-24 04:15:43 +02:00
Returns [code]true[/code] if a connection is available for taking.
2017-09-12 22:42:36 +02:00
</description>
</method>
2019-06-30 19:28:13 +02:00
<method name= "is_listening" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
2019-06-30 19:28:13 +02:00
<description >
Returns [code]true[/code] if the server is currently listening for connections.
</description>
</method>
2017-09-12 22:42:36 +02:00
<method name= "listen" >
2021-07-30 15:28:05 +02:00
<return type= "int" enum= "Error" />
<argument index= "0" name= "port" type= "int" />
<argument index= "1" name= "bind_address" type= "String" default= ""*"" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Listen on the [code]port[/code] binding to [code]bind_address[/code].
If [code]bind_address[/code] is set as [code]"*"[/code] (default), the server will listen on all available addresses (both IPv4 and IPv6).
If [code]bind_address[/code] is set as [code]"0.0.0.0"[/code] (for IPv4) or [code]"::"[/code] (for IPv6), the server will listen on all available addresses matching that IP type.
If [code]bind_address[/code] is set to any valid address (e.g. [code]"192.168.1.101"[/code], [code]"::1"[/code], etc), the server will only listen on the interface with that addresses (or fail if no interface with the given address exists).
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "stop" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
Stops listening.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "take_connection" >
2021-07-30 15:28:05 +02:00
<return type= "StreamPeerTCP" />
2017-09-12 22:42:36 +02:00
<description >
2019-06-22 01:04:47 +02:00
If a connection is available, returns a StreamPeerTCP with the connection.
2017-09-12 22:42:36 +02:00
</description>
</method>
</methods>
<constants >
</constants>
</class>