Subject: Socket connect error ... with Msg " Not Owner"
From: [email-masked] (Mansuriatus Shahrir Amir)

5 Nov 1996 20:46:55 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Original-To: "'GNU-Win32 Mailing List'" <[email-masked]>
Original-Sender: [email-masked]

I have this small program to get email from my pop server.
The program works in Linux but not on my office Win95 machine.

I have written a  test program and managed to narrow down its error.
Here it is
****************************
Excerpt from program
*****************************

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <pwd.h>

#include "config.h"

struct in_addr saddr;

struct hostent *get_hostent(const char *host)
{
int c;
struct hostent *hostinfo;
c = *host;

if (isdigit(c))
    {
     saddr.s_addr = inet_addr(host);
     hostinfo = gethostbyaddr((char *)&saddr, sizeof(struct in_addr), AF_INET);
     if (hostinfo == NULL)
        {
         printf("Network is unreachable\n");
         exit(EXIT_FAILURE);
        }
    }
else
    {
     hostinfo = gethostbyname(host);
     if (hostinfo == NULL)
        {
         printf("gethostbyname Error\n");
         fprintf(stderr, "%s: Unknown host\n", host);
         exit(EXIT_FAILURE);
        }
    }
return hostinfo;
}

int start_connection(const char *host, unsigned short int port)
{
struct hostent *hostinfo;
struct sockaddr_in addr;
int sfd = socket(AF_INET, SOCK_STREAM, 0);

if (sfd == -1)
    {
     perror("socket: creating socket");
     exit(EXIT_FAILURE);
    }
printf("Socket created\n");
hostinfo = get_hostent(host);
printf("After get_hostent\n");
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr = saddr;

//Offending line ****************************************************************
if (connect(sfd, (struct sockaddr *)&addr, sizeof addr) == -1) //<----- Here's
    {                                                                                  //where it fails
     perror(NULL);                                                               // with the mesg "Not owner"
     exit(EXIT_FAILURE);
    }
printf("Connected to %s.\n", hostinfo->h_name);
return sfd;
}

int main(void)
{
    start_connection("mypop.mydomain.mycountry", 110);
    return 0;
}

**************************************
End program
************************************

The offending line is  marked above.
The error message is "Not owner"

Any idea why this is so.
I am running this in bash under win95 on Novell 4.1 compiled with Beta 17
The test program compiled fine using gcc -o test.exe test.c

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".