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

Re: Sockets and posgtres

From: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
To: Jim Nasby <jim(at)nasby(dot)net>
Cc: J S B <jsbali(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Sockets and posgtres
Date: 2006-09-27 16:41:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Jim Nasby wrote:
> If I'm understanding what you're trying to do (have a function connect 
> to an external process?), I don't think anything exists right now. But 
> it shouldn't be too hard to write something to do that. You might want 
> to create a generic utility and put it on pgFoundry in case others 
> find it useful. Oracle has a package that allows for TCP (as well as 
> other communications) from the database; looking at their interface 
> might be useful.
> -- 
> Jim Nasby                                            jim(at)nasby(dot)net
> EnterpriseDB      512.569.9461 (cell)
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
You can easily do that with PLperl

The funtion then connects to the server running on localhost, and sends 
some commands terminated with CRLF.

CREATE or REPLACE FUNCTION public.psendpopup(text,text)
RETURNS pg_catalog.varchar AS
use IO::Socket;
$sock = new IO::Socket::INET (
PeerAddr => 'localhost',
PeerPort => '32000',
Proto => 'tcp',
die "Could not create socket: $!\n" unless $sock;
print $sock "null\r\n";
print $sock "send_broadcast\r\n";
print $sock $_[0]."\r\n";
print $sock $_[1]."\r\n";


Tony Caduto
AM Software Design
Home of PG Lightning Admin for Postgresql
Your best bet for Postgresql Administration 

In response to

pgsql-general by date

Next:From: Kai HessingDate: 2006-09-27 16:42:38
Subject: Re: Dead Lock problem with 8.1.3
Previous:From: Casey DuncanDate: 2006-09-27 16:33:07
Subject: Re: postgress 8.1.4 deadlocking??

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