pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: PG-JDBC Mailing List <pgsql-jdbc@postgresql.org>
Subject: Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify
Date: Mon, 21 Dec 2009 21:44:00 +0800
Message-ID: <4B2F7BA0.4080106@postnewspapers.com.au> (raw)
In-Reply-To: <e6af340fadaaf23345fdf9aa6c2fed16@smogura-softworks.eu>
References: <C746D04C.CAE15%scott_ribe@killerbytes.com>
	<4B2267A9.1080302@postnewspapers.com.au>
	<4B2C7A13.9080807@postnewspapers.com.au>
	<675723c4dae1093da0a64f50ac6327e7@smogura-softworks.eu>
	<4B2F6999.2050309@postnewspapers.com.au>
	<e6af340fadaaf23345fdf9aa6c2fed16@smogura-softworks.eu>

(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



view thread (11+ messages)  latest in thread

Message-ID: <4B2F7BA0.4080106@postnewspapers.com.au>
Permalink:  ../4B2F7BA0.4080106@postnewspapers.com.au/
Also on:    postgresql.org/message-id/4B2F7BA0.4080106@postnewspapers.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: craig@postnewspapers.com.au
  Subject: Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify
  In-Reply-To: <4B2F7BA0.4080106@postnewspapers.com.au>
  References: <C746D04C.CAE15%scott_ribe@killerbytes.com> <4B2267A9.1080302@postnewspapers.com.au> <4B2C7A13.9080807@postnewspapers.com.au> <675723c4dae1093da0a64f50ac6327e7@smogura-softworks.eu> <4B2F6999.2050309@postnewspapers.com.au> <e6af340fadaaf23345fdf9aa6c2fed16@smogura-softworks.eu> <4B2F7BA0.4080106@postnewspapers.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox