-
Socket Drawing Program
hey I want to make a program in C or C++ where that I have two people on different sides of the Internet or a network and when one person draws on a dialog with the mouse, whatever they draw appears on the other person's screen (both are using hte same program).
Could I do this with sockets? Would this have to go through a server, or could one of these two computers act as the server? What if one is behind a firewall - could I use a proxy server?
If it would use sockets, what standard library could I use? Is it sockets.h or something?
-
Correct.
One solution is socket. You can send an array of coordinates.
Kuphryn
-
Ok. Do I have to go through a server, or can one of the two computers act like a server, or can it even be a P2P connection?
-
Both computers could have a server, and then both a client. Then the clients just read the servers.
-
So basically it's a peer-to-peer connection. I'll post again if I actually make this program and let you guys see what you think.
-
What if I'm behind a firewall and the other person is not? Could I still do this? Would I need to use a proxy server?
-
Where's the problem? Guy hwo is not behind firewall/NAT makes a server and guy who is behind firewall/NAT connects.
-
Ok gotcha. What if we're both behind firewalls?
-
it has nothing to do with your code! You will just have to allow the programs/port on both sides.
-
imagine you have blue water in a bag at your house. your friend has red water at his house. You want to each have each other's water. Let's assume you still live at home.
You go to the store and buy a hose. A BIG one. You connect it to you bag, run to your friends house. You convince his mom that it's ok. You plug the hose into his empty bag, run back home, and squeeze. Whoop de do. Then, you put your end onto your empty bag, and he squeezes. Yay.
Basically, yes one end must be a "server". All that means is that it receives a connection, like your friends bag. The firewall infront of that must allow the connection of that specific port, like your friends mom. Then you just send and receive data.