Search Postgresql Archives

Startup messages for socket protocol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

I've been trying to get a connection working to a PostgreSQL server
through the socket-level protocol. I've therefore been looking at
fe-connect.c and fe-protocol3.c in the src/interfaces/libpq folder.

Reading those sources, I understood, that the startup message should
begin with a request from the client with the protocol number.

In fe-protocol3.c, build_startup_message():

        /* Protocol version comes first. */
        if (packet)
        {
                ProtocolVersion pv = htonl(conn->pversion);

                memcpy(packet + packet_len, &pv, sizeof(ProtocolVersion));
        }
        packet_len += sizeof(ProtocolVersion);

However, when I try to send this as the first thing, I get disconnected
by the server. Reading what the psql program does, I first get an 8 byte
message containing this:

			\000\000\000\008\004\210\022/

This seems to work, but I'm at a loss pinpointing in the libpq source
code where that would fit in the protocol.

Enlightenment would be very welcome.

-- 
     Guillaume Yziquel

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux