Skip to content
0.2.0-dev Download ZIP
37 lines ·1.9 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="TCPServer" inherits="SocketServer" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A TCP server.
5 </brief_description>
6 <description>
7 A TCP server. Listens to connections on a port and returns a [StreamPeerTCP] when it gets an incoming connection.
8 [b]Note:[/b] When exporting to Android, make sure to enable the [code]INTERNET[/code] permission in the Android export preset before exporting the project or using remote deploy. Otherwise, network communication of any kind will be blocked by Android.
9 </description>
10 <tutorials>
11 </tutorials>
12 <methods>
13 <method name="get_local_port" qualifiers="const">
14 <return type="int" />
15 <description>
16 Returns the local port this server is listening to.
17 </description>
18 </method>
19 <method name="listen">
20 <return type="int" enum="Error" />
21 <param index="0" name="port" type="int" />
22 <param index="1" name="bind_address" type="String" default="&quot;*&quot;" />
23 <description>
24 Listen on the [param port] binding to [param bind_address].
25 If [param bind_address] is set as [code]"*"[/code] (default), the server will listen on all available addresses (both IPv4 and IPv6).
26 If [param bind_address] 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.
27 If [param bind_address] 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 address (or fail if no interface with the given address exists).
28 </description>
29 </method>
30 <method name="take_connection">
31 <return type="StreamPeerTCP" />
32 <description>
33 If a connection is available, returns a StreamPeerTCP with the connection.
34 </description>
35 </method>
36 </methods>
37</class>