Thread: using socket to communicate between programs on one computer

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    205

    using socket to communicate between programs on one computer

    Hi,
    I have to separate programs. Usually they would be located on different computers and communicate between themselves using the CSocket class. My question is for testing purposes, can I run the two programs on 1 computer and then have one send data to a port A and the other one read data from port A. Would that work. Thanks
    Amish

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Sure, just pick two different ports and 127.0.0.1 as the host, it should work.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

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

    True for TCP: once a process is listening on a port, no other processes can listen on that same port. Many processes can connect to the same port.

    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Socket program
    By mhetfield in forum C Programming
    Replies: 5
    Last Post: 04-03-2007, 03:46 PM
  2. Slight problem with socket reading!!!
    By bobthebullet990 in forum C Programming
    Replies: 5
    Last Post: 02-15-2006, 09:55 AM
  3. Socket class OOD
    By lord mazdak in forum C++ Programming
    Replies: 6
    Last Post: 12-17-2005, 01:11 AM
  4. Socket Help - Multiple Clients
    By project95talon in forum C Programming
    Replies: 5
    Last Post: 11-17-2005, 02:51 AM
  5. Tabbed Windows with MDI?
    By willc0de4food in forum Windows Programming
    Replies: 25
    Last Post: 05-19-2005, 10:58 PM