connecting to a computer inside a LAN
I was wondering:
how is it possible to connect to a computer inside a LAN.
My friend and I are in the same LAN and when we go to a website which tells us our IPs, we both get the same ip: 18.104.22.168.
So if we both set up our own servers, then how can a client recognize that 1 server is mine and the other is his. My guess would be that the use of MAC numbers will help to make a difference between me and him, but how is it exactly?
Can anyone give me a sample code on how to connect to LAN computer. (when the outside client can't actually connect via a simple IP).