Using socket operations in strored SPI procedures. What cause it? - Mailing list pgsql-interfaces

From Aidamir Lovpache
Subject Using socket operations in strored SPI procedures. What cause it?
Date
Msg-id 20030212173207.66981cad.archibald@mastak.ru
Whole thread Raw
List 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
shorttime 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));

   inet_aton(BROADCAST,&myaddr.sin_addr);      myaddr.sin_family=AF_INET;   myaddr.sin_port=htons(BIND_PORT);
      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);
 
   close(fd);







                        (Aidamir Lovpache) Archibald. mailto:archibald@mastak.ru


pgsql-interfaces by date:

Previous
From: Hans-Jürgen Schönig
Date:
Subject: DBI transaction handling ...
Next
From: Rudy Lippan
Date:
Subject: Re: Prepare and prepare ?