mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-29 20:51:14 +00:00 
			
		
		
		
	 7adf4cc9b5
			
		
	
	
		7adf4cc9b5
		
			
		
	
	
	
	
		
			
			For the time being we don't support writing a description for those, preferring having all details in the method's description. Using self-closing tags saves half the lines, and prevents contributors from thinking that they should write the argument or return documentation there.
		
			
				
	
	
		
			56 lines
		
	
	
	
		
			2.1 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
	
		
			2.1 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
| <?xml version="1.0" encoding="UTF-8" ?>
 | |
| <class name="TCPServer" inherits="RefCounted" version="4.0">
 | |
| 	<brief_description>
 | |
| 		A TCP server.
 | |
| 	</brief_description>
 | |
| 	<description>
 | |
| 		A TCP server. Listens to connections on a port and returns a [StreamPeerTCP] when it gets an incoming connection.
 | |
| 	</description>
 | |
| 	<tutorials>
 | |
| 	</tutorials>
 | |
| 	<methods>
 | |
| 		<method name="get_local_port" qualifiers="const">
 | |
| 			<return type="int" />
 | |
| 			<description>
 | |
| 				Returns the local port this server is listening to.
 | |
| 			</description>
 | |
| 		</method>
 | |
| 		<method name="is_connection_available" qualifiers="const">
 | |
| 			<return type="bool" />
 | |
| 			<description>
 | |
| 				Returns [code]true[/code] if a connection is available for taking.
 | |
| 			</description>
 | |
| 		</method>
 | |
| 		<method name="is_listening" qualifiers="const">
 | |
| 			<return type="bool" />
 | |
| 			<description>
 | |
| 				Returns [code]true[/code] if the server is currently listening for connections.
 | |
| 			</description>
 | |
| 		</method>
 | |
| 		<method name="listen">
 | |
| 			<return type="int" enum="Error" />
 | |
| 			<argument index="0" name="port" type="int" />
 | |
| 			<argument index="1" name="bind_address" type="String" default=""*"" />
 | |
| 			<description>
 | |
| 				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).
 | |
| 			</description>
 | |
| 		</method>
 | |
| 		<method name="stop">
 | |
| 			<return type="void" />
 | |
| 			<description>
 | |
| 				Stops listening.
 | |
| 			</description>
 | |
| 		</method>
 | |
| 		<method name="take_connection">
 | |
| 			<return type="StreamPeerTCP" />
 | |
| 			<description>
 | |
| 				If a connection is available, returns a StreamPeerTCP with the connection.
 | |
| 			</description>
 | |
| 		</method>
 | |
| 	</methods>
 | |
| 	<constants>
 | |
| 	</constants>
 | |
| </class>
 |