This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Determining network ERROR codes


  > 
  > Ok, how do I know what error corresponds to what?  I got an error of
331
  > on a connect () call.  Aren't these supposed to be standard errors?
  > They don't seem to return the same errors as they do on Windows.
Maybe
  > windows redefines them!
  > 
  > Anyhow, where do I look for this information?
  > 

I have the following code.  Connect keeps returning 331 EADDRNOTAVAIL.
I have no idea why that might happen.  This program would work with a
few modifications on linux and windows as far as I recall.  Inet_addr ()
does return an IP address in network byte order so I can't see that
being a problem.  Any ideas?

    int s;
    int one = 1;
    struct sockaddr_in addr;

    diag_printf("Start socket test\n");

    s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    diag_printf("socket() = %d\n", s);

    addr.sin_addr.s_addr = inet_addr ("172.16.1.9");
    addr.sin_family = AF_INET;
    addr.sin_port = htons (1024);
    addr.sin_len = sizeof (addr);
    if (connect (s, &addr, sizeof (addr)) != 0)
    {
        diag_printf ("Error connecting to socket! - %d\n", 
            errno);
        cyg_test_exit();
    }

    send (s, "Hello From eCos", strlen ("Hello From eCos"), 0);

    cyg_test_exit();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]