UDP connect: Can't assign requested address or "how to determine the outgoing IP address?"

From: Edwin Groothuis (edwin_at_mavetju.org)
Date: 10/23/03

  • Next message: Lev Walkin: "Re: UDP connect: Can't assign requested address or "how todetermine the outgoing IP address?""
    Date: Thu, 23 Oct 2003 12:31:46 +1000
    To: freebsd-net@freebsd.org
    
    
    

    Hello,

    I got a nice piece of code (see attachment) which could be used to
    determine the outgoing IP address for an UDP socket. It works without
    problem under Linux, but it fails on FreeBSD (-current and -stable)
    during the call to connect() with the error: "Can't assign requested
    address". The code looks like the udpcli09.c example in Richard
    Stevens 'Unix Network Programming' book, which states it doesn't
    work on SVR4 derived kernels.

    So, the question is, how can I determine the outgoing IP address
    for a socket?

    Edwin

    attached code can be compiled with "gcc -Wall -g -o a a.c && ./a"

    -- 
    Edwin Groothuis      |            Personal website: http://www.mavetju.org
    edwin@mavetju.org    |    Weblog: http://www.mavetju.org/weblog/weblog.php 
    
    
    

    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"



  • Next message: Lev Walkin: "Re: UDP connect: Can't assign requested address or "how todetermine the outgoing IP address?""

    Relevant Pages