harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ray Chen (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6360) [classlib][luni]SocketTest and UnixSocketTest failed on AIX, because AIX do NOT support connect to port 0
Date Tue, 20 Oct 2009 06:44:59 GMT
[classlib][luni]SocketTest and UnixSocketTest failed on AIX, because AIX do NOT support connect
to port 0
---------------------------------------------------------------------------------------------------------

                 Key: HARMONY-6360
                 URL: https://issues.apache.org/jira/browse/HARMONY-6360
             Project: Harmony
          Issue Type: Test
          Components: Classlib
         Environment: AIX
            Reporter: Ray Chen
            Priority: Minor


SocketTest failed on AIX at the statement "Socket s = new Socket("0.0.0.0", 0, false);" which
create a socket in local and connect to IP address and port specified (0.0.0.0:0), which in
turn actually connect to (machineIP:0) in PlainSocketImpl.java

However AIX and some other Unix platform do NOT support connect to port 0.
For example, following small C program will get EADDRNOTAVAIL error on AIX and zos but works
well on Linux.

#define  PORT    0
#define SERVER_IP    "127.0.0.1" /*your machine IP*/   

main()
{
    int s;
    struct sockaddr_in  addr;
    char buffer[256];
    if((s = socket(AF_INET, SOCK_DGRAM, 0)) <0) {
        perror("socket");
        exit(1);
    }
   
    bzero(&addr, sizeof(addr));
    addr.sin_family = AF_INET;
    addr.sin_port = htons(PORT);
    addr.sin_addr.s_addr= inet_addr(SERVER_IP);
   
     if(connect(s, (struct sockaddr*)&addr, sizeof(addr))<0) {
           perror("connect");
           printf("%d\n",errno);
           exit(1);
     } else {
        printf("connect successfully\n");
    }
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message