Re: Using Sockets in postgres

From: "Albe Laurenz" <all(at)adv(dot)magwien(dot)gv(dot)at>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using Sockets in postgres
Date: 2006-10-17 06:58:53
Message-ID: 52EF20B2E3209443BC37736D00C3C1380AE3B9C6@EXADV1.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> I've made a client and a server program in C using socket library.
>
> My goal is to compile the client as a shared object, load it
> dynamically in postgres (in a function), execute that
> postgres function in which this shared library (client) is
> dynamically loaded and connect to the server (hosted on some
> other machine outside the domain of postgres database server).
> In otherwords, connecting to another server through postgres
> database using the client code dynamically loaded in postgres.

Have you considered using dblink from the contrib modules?

> Now, here starts the problem. In my client code when i use
> functions like gethostbyname as follows,
>
> server = gethostbyname("www.yahoo.com");
> serv_addr.sin_addr.s_addr = inet_addr("server");
>
> It closes my postgres server and gives the follwowing error message:-
>
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
>
> After commenting my code at various lines, I figured out that
> gethostbyname() function is the cause of this error message.

Did you get a core dump? If not, check your ulimits (assuming that
you are on some flavour of UNIX).
Use the degugger to examine the core dump, that might give some insight.

Yours,
Laurenz Albe

Browse pgsql-general by date

  From Date Subject
Next Message Peter 2006-10-17 07:27:17 help with sql query
Previous Message J S B 2006-10-17 06:49:14 Using Sockets in postgres