Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unhappy peer-to-peer connection wont work

    Im trying to create a p2p connection and the p2p connection logic goes like this:

    Code:
    p2p main{
    server connection setup
    fork_1()
    child: 
        for(;;) accept connections 
        fork_2()
            child: do p2p connection when a connection is received from a peer
            parent: keep listening for new connections
    parent: do client/server connection (is kept open all the time)
    }
    could someone tell me where the logic fails? im connected to the server from the client alrite but when i try from another computer to connect to the p2p (say client1) from another p2p (say client 2) (second fork should handle that) the second client says it cannot connect to client 1..

    Code:
    if (connect(sd, (struct sockaddr *)&peer, sizeof(peer)) == -1) {
    	fprintf(stderr, "Can't connect.\n");
    	exit(1);
    }
    Please help

  • #2
    Regular Coder
    Join Date
    May 2004
    Location
    New Hampshire, America
    Posts
    246
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Post more code, can't see the problem from 1 statement and pseudo code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •