Startup messages for socket protocol
От | Guillaume Yziquel |
---|---|
Тема | Startup messages for socket protocol |
Дата | |
Msg-id | 20110317142041.GX22969@localhost обсуждение исходный текст |
Ответы |
Re: Startup messages for socket protocol
|
Список | pgsql-general |
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
В списке pgsql-general по дате отправления: