Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify
Дата
Msg-id 4B2F7BA0.4080106@postnewspapers.com.au
обсуждение исходный текст
Ответ на Cheapest way to poll for notifications? & Driver improvement question re SSL and notify  (Craig Ringer <craig@postnewspapers.com.au>)
Ответы Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify
Список pgsql-jdbc
(Re-sent, this time to the list)

On 21/12/2009 9:13 PM, rsmogura@softperience.pl wrote:

> I haven't seen 1.4.2 JDK for ages :), but there is method
> javax.net.ssl.SSLSocketFactory.createSocket that takes as the 1st argument
> plain socket, there is no need to "forgot" plain socket (and it can be
> used, actually it's used for SSL communication with lazy handshake
> FTPS/SMTPS...).

That's how the PgJDBC driver works - it wraps an existing socket in an
SSLSocket when SSL negotiation begins. Pg always begins with a plain
text connection - it doesn't have a separate SSL port - so it has to
begin with a plaintext connection and then request SSL negotiation using
a plaintext message.

> Unfortunatly plainSocket can have some available bytes, but sslsoket.read
> can return EOF. But this was i saw on SUN JDK is that read(new byte[0]) on
> SSL socket causes process plain data.

I'm pretty sure it also blocks if there's nothing to read. You'd have to
run that in a background thread to force processing of any pending data
by the SSL engine. If you're going to do that, you may as well just have
a dedicated background thread to do all the reading from the socket...

--
Craig Ringer

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify
Следующее
От:
Дата:
Сообщение: Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify