Well, yes and no. You must first decide who's gonna be the host and who's gonna be the client. The host has to give the client his IP, and tell the program to go there. Then the host becomes P1 and the client P2.
Really? That's how most online games used to be prior the online gaming revolution back in 1997. Unless you were playing in LAN of course.