I think that most chat apps, to speak very easy, use a server where you logon when yuo start the program, the program tells the server which ip you have and that way it knows where to send the msg's too.
Got to say that I had a chat app working, but I needed to use a program like icq to figure out the ip of the other side.
(but, if you have a static ip, you can let the program send the users ip to you (and hardcode your ip) so you can reply to msg's...
At least this will work if only a few users use the programs.