#21 Patch to bind to an IP

open
nobody
None
5
2005-03-16
2005-03-16
pvp|kama
No

This patch will allow you to add what ip to listen to. I included a new flag
(-i) for this option..

-i ip Listen for connection on ip. (default all ip's)

Discussion

  • pvp|kama

    pvp|kama - 2005-03-16

    The patchfile

     
    Attachments
  • pvp|kama

    pvp|kama - 2005-03-26

    tracker.cpp changes

     
  • pvp|kama

    pvp|kama - 2005-03-26

    Logged In: YES
    user_id=1056959

    This additional patch is also required to make it all work...

     
  • Galt

    Galt - 2005-05-30

    Logged In: YES
    user_id=1276019

    but why you set the ipo i in Initial_ListenPort, if someone
    wants to fork the ctorrent it crashes couse bind ip is already in
    use. In this case you cannot use more than one instance of
    CTorrent.

     
  • pvp|kama

    pvp|kama - 2005-06-01

    Logged In: YES
    user_id=1056959

    if you dont use -i it should work as before.

    I made this patch so I could have one instance on each IP.
    And it works as it should. I have used it several times on 3
    ip's on the same machine without any problems. I just tested
    to set up two instances of ctorrent on the same IP with and
    without the -i option and it works...

    He also has a 'bug' in his code that I fixed. This was
    required for the ipbind to work, but it worked due to the
    default to bind on *. He was just not following how to
    program socks properly.

    The original code sets the INADDR_ANY (listen to all IP's)
    in the beginning of that function. I then check if we have a
    value for the ip and then sets the IP in the struct before
    it binds. It should not break anything at all. If you skip
    the -i it should not do anything.

    If you look at the patch again, you'll see that I do not do
    anything else than that ifstatement and set that IP if its
    not 0. It should not break anything at all. And its the only
    place I can set the IP before the bind.

    If my code would break, the original code would probably
    also break. Note that I do not do anything with the port at
    any time. Its just the IP I store before I start the bind
    and listen (in tracker.cpp).

    Be warned that its a really simple check. If you add an
    nonfunctional IP it will not bind, it will just spit out
    errors and continue, but it will not operate.

     
  • Galt

    Galt - 2005-06-07

    Logged In: YES
    user_id=1276019

    10u for detailed explanation. I see , you right.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks