Re: connecting to server process via sockets - Mailing list pgsql-general

From Yanni Chiu
Subject Re: connecting to server process via sockets
Date
Msg-id 4288C532.9E8E5BCF@rogers.com
Whole thread Raw
In response to connecting to server process via sockets  (Randall Smith <randall@tnr.cc>)
List pgsql-general
Randall Smith wrote:
>
> For fun and learning, I would like to connect to the Postgresql backend
> and issue queries using sockets.  I'm using Python's socket module.  I'm
> new to socket programming, but I'm experienced with Python and
> Postgresql.

Look in the postgres docs for the section on frontend/backend protocol.
The handshaking and format of the bytes that go across the socket
are explained in that doc. section.

You also might want to look at:

    http://ca.geocities.com/zazu@rogers.com/pgsqueak/

where there are links to a class diagram and state diagram
of an implementation done in Squeak Smalltalk. I don't know
Python, but IMHO the basic design should be transferable.

Note that frontend/backend protocol version 2 is implemented
in that code, and the current docs will reflect version 3
(so you'd have to look at the older docs to match up the code).

Hope that helps.
--yanni

pgsql-general by date:

Previous
From: Douglas McNaught
Date:
Subject: Re: connecting to server process via sockets
Next
From: "Lada 'Ray' Lostak"
Date:
Subject: Re: Sequences question & problem