How to send a datagram to an external ip?

I am working with udp for the first time. I could only sent datagrams to devices in same network because we can define only ip and port for Address. But it is not enough for sending a data to external address i guess. How can i send a datagram to an external ip? Thanks :slight_smile: