Thread: Socket Drawing Program

  1. #1
    Chad Johnson
    Join Date
    May 2004
    Posts
    154

    Question 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?

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Correct.

    One solution is socket. You can send an array of coordinates.

    Kuphryn

  3. #3
    Chad Johnson
    Join Date
    May 2004
    Posts
    154
    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?

  4. #4
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    Both computers could have a server, and then both a client. Then the clients just read the servers.
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  5. #5
    Chad Johnson
    Join Date
    May 2004
    Posts
    154
    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.

  6. #6
    Chad Johnson
    Join Date
    May 2004
    Posts
    154
    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?

  7. #7
    Registered User
    Join Date
    Jun 2004
    Posts
    84
    Where's the problem? Guy hwo is not behind firewall/NAT makes a server and guy who is behind firewall/NAT connects.

  8. #8
    Chad Johnson
    Join Date
    May 2004
    Posts
    154
    Ok gotcha. What if we're both behind firewalls?

  9. #9
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    it has nothing to do with your code! You will just have to allow the programs/port on both sides.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  10. #10
    Registered User crepincdotcom's Avatar
    Join Date
    Oct 2003
    Posts
    94
    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.
    -Jack C
    jack {at} crepinc.com
    http://www.crepinc.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  3. Box Drawing Program
    By donniebb in forum C++ Programming
    Replies: 4
    Last Post: 02-09-2003, 02:40 PM
  4. drawing over the open program.
    By Unregistered in forum Windows Programming
    Replies: 6
    Last Post: 01-23-2002, 03:37 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM