Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting remote UDP peer address and port using getpeername()?

Tags:

tcp

sockets

udp

Will getpeername() return the IP address info of the remote UDP peer ? I suspect that it is not going to work as it requires connection.

Please confirm whether getpeername() can be used to get the remote UDP peer address.

like image 360
Anil Kumar K K Avatar asked Jan 24 '26 17:01

Anil Kumar K K


1 Answers

If a UDP socket isn't connected there is no peer. So there can't be a peer name.

And if it is connected, you already know who you connected it to.

like image 181
user207421 Avatar answered Jan 27 '26 19:01

user207421



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!