Skip site navigation (1) Skip section navigation (2)

Using socket operations in strored SPI procedures. What cause it?

From: Aidamir Lovpache <archibald(at)mastak(dot)ru>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Using socket operations in strored SPI procedures. What cause it?
Date: 2003-02-12 14:32:07
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
	I use SPI strored procedures for sending broadcasts through sockets by sendto function. 
If you have such experience, please tell me what problem can cause it, if it could block the postmaster process for short time or 
some other problems unknown for me. I still have't noticed any problems yet. Here are the code i use for sending UDP broadcasts:

    int ret;
    int fd = socket( PF_INET, SOCK_DGRAM , 0);
    extern int errno;
    struct sockaddr_in myaddr;
    int t=1;

    setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &t, sizeof(int));

    if ( fd < 0 )
        elog(NOTICE,"setsockopt() %s\n", strerror(errno));


    ret = sendto(fd, p, len , 0,
		(struct sockaddr * ) &myaddr, 
		sizeof(struct sockaddr_in));

    if ( ret < 0 )
        elog(NOTICE,"sendto() %s\n", strerror(errno));
    else elog( NOTICE,"%d bytes was sent to FE.\n",ret );


							(Aidamir Lovpache) Archibald. mailto:archibald(at)mastak(dot)ru

pgsql-interfaces by date

Next:From: David WheelerDate: 2003-02-12 15:51:03
Subject: Re: Prepare and prepare ?
Previous:From: Rudy LippanDate: 2003-02-12 03:51:52
Subject: Re: Prepare and prepare ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group