Click or drag to resize

PacketPeerUDPConnectToHost Method

Calling this method connects this UDP peer to the given host/port pair. UDP is in reality connectionless, so this option only means that incoming packets from different addresses are automatically discarded, and that outgoing packets are always sent to the connected address (future calls to SetDestAddress(String, Int32) are not allowed). This method does not send any data to the remote peer, to do that, use PutVar(Object, Boolean) or PutPacket(Byte) as usual. See also UDPServer.

Note: Connecting to the remote peer does not help to protect from malicious attacks like IP spoofing, etc. Think about using an encryption technique like SSL or DTLS if you feel like your application is transferring sensitive information.

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public Error ConnectToHost(
	string host,
	int port
)

Parameters

host
Type: SystemString

[Missing <param name="host"/> documentation for "M:Godot.PacketPeerUDP.ConnectToHost(System.String,System.Int32)"]

port
Type: SystemInt32

[Missing <param name="port"/> documentation for "M:Godot.PacketPeerUDP.ConnectToHost(System.String,System.Int32)"]

Return Value

Type: Error

[Missing <returns> documentation for "M:Godot.PacketPeerUDP.ConnectToHost(System.String,System.Int32)"]

See Also