TCP/IP connection over global internet connection (C/C++) [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Essentially I've been trying to relay messages between two computers using c/c++ using standard socket programming. Everything works fine on LAN. The issue is making the connection using something like external ip address. I searched online and saw methods that mention ensuring the router is configured for "port forwarding". However, I was wondering how do peer to peer communication apps like qTox overcome this barrier, since they do not require that technical step? To summarize, how can I connect two sockets between two computers that are NOT on the same network?

here is some methods we usually use to solve the problem.
If you can use a server in WLAN as relay or central controller, it's quite simple. The computers connect to the server, the server change messages for them and can do many more operations.
If you don't want to use a server, then here is a problem: NAT devices may drop those packets which haven't established a connection according to their type. Here are four types: full cone NAT, restricted NAT, port restricted NAT and symmetric NAT. And here are some methods for this circumstance
2.1 Use NAT traversal algorithm, but they may not work well in symmetric NAT.
2.2 Use STUN/TURN/ICE to realise NAT traverse, it's quite reliable but need to learn how to use them.

Related

What exactly network implementation has been used in Blockchains? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I'm already working on a blockchain project, However I have a problem on implementing a peer to peer network between nodes. I found a Udemy course and in that course Redis pub/sub was used for peet to peer network but is it only available in a local network right ? or in another article it says that there are some main nodes that run 24/7 so others first make connection with them. but is it not sort of server-side network ??
my question is how can I actually implement a peer to peer network that many nodes around the world can communicate with each other without any main server ?
Usual implementation of P2P connection is to have one predefined port (for example in case of Bitcoin Core it's 8333) and the applications periodically broadcast their messages on this particular port.
It's also usual to have in your app a preset list of nodes that are likely to be online 24/7, so that the app can listen to their messages right from the startup and doesn't have to wait for other nodes to broadcast their presence.
The app can keep a list of currently active nodes (for example the ping period is 60 seconds, so any node that has pinged within the last 60 seconds is considered active) in case it needs to communicate with the other nodes directly.
But most communication is usually done via broadcasting and listening to messages on the predefined port.

Connection without TCP/IP over Internet [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Today I am thinking about connect two computer without tcp/ip. Actually i am searching: connection without ip; if i manage to connect without ip, these network is untraceable.
My full question is :
It is possible to connect two computer without tcp/ip over internet.
May these scenario impossible for the ISP. I don't know.
If possible, It can be competitor of Internet.
From the first line of Wikipedia on Internet:
The Internet is a global system of interconnected computer networks that use the standard Internet protocol suite (TCP/IP) to link several billion devices worldwide.
The internet is built upon the IP framework. You can't "not use" IP through the internet. That's like to say I want to use the post system without addresses. Without the IP framework, there is no way to identify devices from each other or have any standard format to route packets anywhere at all. This is not to say that it is the only way to establish networked communications, it's just the most popular and most used way.
Regarding the first part of your question: It is possible to connect two computer without tcp/ip? There are plenty of ways this is done e.g. Bluetooth, RS-232, proprietary RF communications and so forth.
Also, towards competitor of Internet is that really such a good idea? For once we have one system that is universally compatible with all devices around the globe (almost!). I don't think the rest of the world would be keen on a brand new system unless it is much much much better (in which it'll probably be implemented into the Internet Protocol Suite anyway).

How to handle a single connection from multiple clients on a single ip using TCP [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to develop a server for an application of mine in C++. I'm not really familiar with networking concepts. This server is going be a simple one and I'll use one of the networking libraries out there. I just couldn't figure out the necessary keywords to research the following issue:
Let's say that there are 100 users on 100 different computers, all sharing the same internet connection, behind the same router. They all decide to open my client to connect to my server. How do you deal with this issue if you want to keep the connections open and on the same port.
For the purposes of your server, it doesn't make any difference whether those 100 connections are all coming from the same computer, from the same router, or from totally separate networks.
While the server side of the connection will use the same port for all of these, each connection will have a different combination of client side IP address and port. In the case you describe, where all 100 are behind the same router using the same IP address, the router will take care of making sure they all have different client side port numbers. You can read about network address translation (NAT) if you want to learn the details about one common way that is done.
This kind of server programming is not easy and requires network skills. You can have a look at this tutorial. It's C and unix, but it shows the function you'll need to use:
socket interface for network access
listening/accepting new connextion
forking new processes to handle the different clients (although in C++ you'd probebly look for multithreading which is more efficient for this kind of task).

How Should I Implement Security On UDP Socket [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm working on a peer to peer networking application but I cannot solve how I'm going to provide security on UDP sockets.
I don't want to reinvent the wheel, but I don't which method I should choose to implement security.
My idea is to generate RSA keys between every peer and share these keys over an insecure socket at first and keep the connection secure with those keys. But I'm not sure about how to implement RSA and if this is the most secure way to go.
I'm using C++ for this project by the way
Thank you very much
You are looking for DTLS, the Datagram TLS.
It is like the TLS protocol that you know from HTTPS and various other secure point-to-point communication links, but it is implemented over UDP. You will find it already implemented in various libraries including GnuTLS and OpenSSL.
From the security point-of-view, one major difference between TLS and DTLS is that TLS defines an ill-formed message as an unrecoverable error, whereas DTLS specifically allows the connection to continue in this case. This makes the protocol more sensitive to even slight coding errors (think Lucky Thirteen), so you had better not try to implement it yourself.

How to test internet application at local computer (windows-7)? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
This application sends data periodically to a server. What I need to do is setup a testing environment on the local developing machine so that I can check the correct packets are being sent in each situation. I thought a good approach would be a server VM set up on the local computer which would receive the packets and respond just like the real thing, but the problem is how do I route the packets of an application running on windows to a VM machine. I don't want to modify my application code. I just want to have windows pass on the packets it receives from the application to the VM or otherwise another application that will do the testing. Is this possible? If not, please let me know about any other solution(s) to this problem.
If you're running a decent VM you should be able to give it an IP address visible from the host, and configure it so that you can run web servers on it, ssh to it, etc.
Look at the networking features of your VM. Or find a tutorial on how to do this, such as this one for VirtualBox:
http://www.tolaris.com/2009/03/05/using-host-networking-and-nat-with-virtualbox/
Well it's some kind of a hack but you can use ARP Poisoning (man in the middle attack) to sniff packets. There is a tool named Cain & Abel which can do this for you. I've used this tool to sniff packets between two non-pc machines. Use at your own risk and if your anti-virus tool alerts, know that the tool has no virus but what it does is detected as one.
Edit: Please note that my approach doesn't require a VM server.