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

Frontend/Backend Protocol

From: Jonathan Dale <jdale(at)fla(dot)fujitsu(dot)com>
To: pgsql-hackers(at)postgresql(dot)org, pgsql-ports(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Frontend/Backend Protocol
Date: 1999-07-22 07:01:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-interfacespgsql-ports

I am trying to write an interface for accessing the postmaster and
subsequently a postgres database server in a language that our group has
written, which is called APRIL. However, I am having a few problems
making the connection.

I appear to be able to make a successfuly connection to the postmaster
by making a normal socket connection to port 5432 and sending a startup
packet, which consists of:

00 00 01 20  as the length (296 bytes)
00 02 00 00  as the major and minor protocol numbers (2.0)
"dbname\0"   as a 64 byte string representing the database name
"postgres\0" as a 32 byte string representing the user name
"\0"         as a 64 byte string representing the options
"\0"         as a 64 byte string representing unused bytes
"\0"         as a 64 byte string representing the tty

And I get back:

"R" 00 00 00 00  which indicates a successful connection

However, when my process has read this, the postmaster displays the
following error:

FATAL 1:  Socket command type   unknown

and the connection is closed.

Does anyone have any idea of what I am doing wrong? I assumed that the
postmaster would fork a new postgres process to handle my connection and
I should be expecting some data on the socket to tell me that the
postgres process is ready for an SQL query. The postmaster is being
executed with the -i option.

Thanks in advance,

| "Never settle with words what you can accomplish with a           |
|  flamethrower."  -- Bruce Feirstein                               |

Attachment: jdale.vcf
Description: text/x-vcard (396 bytes)

pgsql-ports by date

Next:From: Unprivileged userDate: 1999-07-22 07:17:43
Subject: Port Bug Report: rules regression test SEGV
Previous:From: Thomas LockhartDate: 1999-07-22 05:45:47
Subject: Re: [PORTS] Port Bug Report: postgresql Won't Start

pgsql-hackers by date

Next:From: F.J.CuberosDate: 1999-07-22 07:22:04
Previous:From: Don BaccusDate: 1999-07-22 04:07:48
Subject: RE: [HACKERS] Re: [BUGS] Dropped connection during COPY causes t

pgsql-interfaces by date

Next:From: Michael YeungDate: 1999-07-22 08:19:17
Subject: Buffer Size
Previous:From: Thomas LockhartDate: 1999-07-22 01:49:13
Subject: Re: [INTERFACES] invalid command name "pg_connect" on tcl/tk script

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