mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Add optional IP type param in TCP/UDP connect/set_send_address
(cherry picked from commit 2f1c859272)
This commit is contained in:
parent
70a6791150
commit
a2048efd72
4 changed files with 24 additions and 5 deletions
|
|
@ -38,13 +38,13 @@ String PacketPeerUDP::_get_packet_ip() const {
|
|||
return get_packet_address();
|
||||
}
|
||||
|
||||
Error PacketPeerUDP::_set_send_address(const String& p_address,int p_port) {
|
||||
Error PacketPeerUDP::_set_send_address(const String& p_address,int p_port,IP_Address::AddrType p_type) {
|
||||
|
||||
IP_Address ip;
|
||||
if (p_address.is_valid_ip_address()) {
|
||||
ip=p_address;
|
||||
} else {
|
||||
ip=IP::get_singleton()->resolve_hostname(p_address);
|
||||
ip=IP::get_singleton()->resolve_hostname(p_address, p_type);
|
||||
if (ip==IP_Address())
|
||||
return ERR_CANT_RESOLVE;
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ void PacketPeerUDP::_bind_methods() {
|
|||
ObjectTypeDB::bind_method(_MD("get_packet_ip"),&PacketPeerUDP::_get_packet_ip);
|
||||
//ObjectTypeDB::bind_method(_MD("get_packet_address"),&PacketPeerUDP::_get_packet_address);
|
||||
ObjectTypeDB::bind_method(_MD("get_packet_port"),&PacketPeerUDP::get_packet_port);
|
||||
ObjectTypeDB::bind_method(_MD("set_send_address","host","port"),&PacketPeerUDP::_set_send_address);
|
||||
ObjectTypeDB::bind_method(_MD("set_send_address","host","port","ip_type"),&PacketPeerUDP::_set_send_address,DEFVAL(IP_Address::TYPE_ANY));
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue