Add optional IP type param in TCP/UDP connect/set_send_address
This commit is contained in:
@ -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));
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user