i need to connect 2 instances of the same wcf application to each other (for testing scenario ).
each client exposes a service endpoint and also as the ability to connect to the same service exposed by his peer .
the end point exposed on each client :
<services>
<service name="BackGammonClient.ClientService">
<endpoint address="net.tcp://localhost:8081/ClientService" binding="netTcpBinding"
bindingConfiguration="" contract="Contracts.Client.IClient" />
</service>
</services>
the problem is that each client exposes the exact same endpoint since they are all running on the same localhost and are given the same port .
how can i dynamically apply a port for each instance of the Client application ?
i was thinking of how i could check if the default endpoint is already taken and apply some running Port number to attach to the address.