I'm basically a developer, and this is the first time i'm trying to develop a chat application over internet without any servers in between. It's easy to send data from PC to server and then to another PC. But i'm lost in search of direct communication (Peer 2 Peer - i don't know that this is correct term.). While searching i came across the concept of UDP, TCP. But in all the examples they used computers in same network. I don't know how to connect exactly the computer that i want which is connected to router along with hundreds of PCs. I came across Ports and stuffs. But it confused me a lot. To make this whole thing simple. I just want to transfer data between two PCs over internet inspite of how they connected to the internet.

  • Programming questions should be asked on Stack Overflow. This is not the place to teach communication fundamentals. – Ron Trunk Apr 30 '19 at 10:16
  • @RonTrunk: Sorry, I didn't ask for programming codes. I asked whether it is possible for direct connection to make. if possible, how? And I know this site is for asking questions related to Networking. And i'm sure i asked network related question. If possible try to answer like serverAdmin123 – Deebash D Apr 30 '19 at 10:37
  • It’s technically possible, although in practice it’s difficult as @serveradmin123 alludes. That’s why no one does it. – Ron Trunk Apr 30 '19 at 10:47

Simple answer is, It is not possible. So you have to have VPN connection or Central Server for Communications.

In your Requirement, You have two option.

  • Chat between User Accounts
  • Direct peer 2 peer chat application. (Connection looks like a teamweaver)

I think First option is very easy to implement and develop. Second option is very complicated.

Teamweaver is looks like a peer 2 peer connection. But Actually it is connected to central server. It does not allowed to access computer directly. So you need to have central server for authentication.

Otherwise You have to have Static IP address from both device. Because TCP cannot keep status when changing IP address. When you establish TCP connection it will use IP address + Port address. Therefore you cannot have stable connection when ip is changed.

  • Thanks for the elaborated answer. So if i keep a server which records IP address and ports status of different users. I can transfer files directly to another user's PC. Right? I can send texts and images through servers but when user sends large data, it would cost me more. so i want to make large file transfers directly between them. – Deebash D Apr 30 '19 at 10:42
  • Yes. Therefore you have to have Static ip address. If you want to send large files, Best thing is upload to centralized server and download to destination. Directly sending will be more costly. I think you have to do cost benefit analysis for this – infra Apr 30 '19 at 10:47
  • Sure. May i know how often does IP address change? I split files with 1 MB pack, and sends each pack to the receiver. Even if IP changes in between 1MB, receiver will ask for that part and re downloads that part and continues – Deebash D Apr 30 '19 at 10:57
  • It is depend on ISP. Generally when your router or connection is restart, your ip will change. – infra Apr 30 '19 at 11:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.