Maybe it's a stupid question (my knowledge in networking is highly limited), but I've been looking several months for the answer and found nothing.
I don't remember where, nor who published it, but this chat example came to my hands
Basically you run a instance of it to create the server of the chat, and then others to be clients. Originally it was limited to one computer (by setting the IP to "localhost"/"127.0.0.1") and later on i modified it to set up a server in a pc and clients in others within my internal network by setting the IP to "192.168.1.X".
It also lets me run several servers in the same computer using different ports so i've been wondering, whats the next step? How do i set up the server in my house and access as client from, say, another city? Using my external IP leads to my router, but i don't know to make it go further or if it's done in a different way
Greetings!