The solution I found is to assign a random identifying number to each peer and attach the identifier to the handshake message as well as registering the identifier with the P2P server. The other solution would be assigning random listening port to the peers so each peer listens on a random port and the probability of two peers with a same port number in a LAN is so low.
This program will show you all currently used ports and the applications which use that ports.
You may get the program here: http://www.foundstone.com/us/resources/termsofuse.asp?file=fport.zip