grmihel
grmihel

Reputation: 846

Get the dynamic alloccated port of a IPEndPoint

How is it possible to get the dynamically assigned port of a IPEndPoint, when you create it with 0 as port:

var endpoint = new IPEndPoint(Dns.GetHostAddresses(localhost).FirstOrDefault(), 0);

If I look at the endpoint.Port, it is 0 (any), even tho the underlaying Socket must have an designated port already?

Upvotes: 1

Views: 685

Answers (1)

Related Questions