Codota Logo
PGStream.changeSocket
Code IndexAdd Codota to your IDE (free)

How to use
changeSocket
method
in
org.postgresql.core.PGStream

Best Java code snippets using org.postgresql.core.PGStream.changeSocket (Showing top 8 results out of 315)

  • Common ways to obtain PGStream
private void myMethod () {
PGStream p =
  • Codota IconString host;new PGStream(host, port)
  • Smart code suggestions by Codota
}
origin: postgresql/postgresql

/**
 * Constructor:  Connect to the PostgreSQL back end and return
 * a stream connection.
 *
 * @param host the hostname to connect to
 * @param port the port number that the postmaster is sitting on
 * @exception IOException if an IOException occurs below it.
 */
public PGStream(String host, int port) throws IOException
{
  this.host = host;
  this.port = port;
  changeSocket(new Socket(host, port));
  setEncoding(Encoding.getJVMEncoding("US-ASCII"));
  _int2buf = new byte[2];
  _int4buf = new byte[4];
}
origin: postgresql/postgresql

stream.changeSocket(newConnection);
origin: org.postgresql/postgresql

/**
 * Constructor: Connect to the PostgreSQL back end and return a stream connection.
 *
 * @param socketFactory socket factory to use when creating sockets
 * @param hostSpec the host and port to connect to
 * @param timeout timeout in milliseconds, or 0 if no timeout set
 * @throws IOException if an IOException occurs below it.
 */
public PGStream(SocketFactory socketFactory, HostSpec hostSpec, int timeout) throws IOException {
 this.socketFactory = socketFactory;
 this.hostSpec = hostSpec;
 Socket socket = socketFactory.createSocket();
 if (!socket.isConnected()) {
  // When using a SOCKS proxy, the host might not be resolvable locally,
  // thus we defer resolution until the traffic reaches the proxy. If there
  // is no proxy, we must resolve the host to an IP to connect the socket.
  InetSocketAddress address = hostSpec.shouldResolve()
    ? new InetSocketAddress(hostSpec.getHost(), hostSpec.getPort())
    : InetSocketAddress.createUnresolved(hostSpec.getHost(), hostSpec.getPort());
  socket.connect(address, timeout);
 }
 changeSocket(socket);
 setEncoding(Encoding.getJVMEncoding("UTF-8"));
 _int2buf = new byte[2];
 _int4buf = new byte[4];
}
origin: org.postgresql/postgresql

public static void convert(PGStream stream, Properties info)
  throws PSQLException, IOException {
 LOGGER.log(Level.FINE, "converting regular socket connection to ssl");
 SSLSocketFactory factory = SocketFactoryFactory.getSslSocketFactory(info);
 SSLSocket newConnection;
 try {
  newConnection = (SSLSocket) factory.createSocket(stream.getSocket(),
    stream.getHostSpec().getHost(), stream.getHostSpec().getPort(), true);
  // We must invoke manually, otherwise the exceptions are hidden
  newConnection.setUseClientMode(true);
  newConnection.startHandshake();
 } catch (IOException ex) {
  throw new PSQLException(GT.tr("SSL error: {0}", ex.getMessage()),
    PSQLState.CONNECTION_FAILURE, ex);
 }
 if (factory instanceof LibPQFactory) { // throw any KeyManager exception
  ((LibPQFactory) factory).throwKeyManagerException();
 }
 SslMode sslMode = SslMode.of(info);
 if (sslMode.verifyPeerName()) {
  verifyPeerName(stream, info, newConnection);
 }
 stream.changeSocket(newConnection);
}
origin: org.ancoron.postgresql/org.postgresql.osgi

/**
 * Constructor:  Connect to the PostgreSQL back end and return
 * a stream connection.
 *
 * @param host the hostname to connect to
 * @param port the port number that the postmaster is sitting on
 * @exception IOException if an IOException occurs below it.
 */
public PGStream(String host, int port) throws IOException
{
  this.host = host;
  this.port = port;
  changeSocket(new Socket(host, port));
  setEncoding(Encoding.getJVMEncoding("US-ASCII"));
  _int2buf = new byte[2];
  _int4buf = new byte[4];
}
origin: org.ancoron.postgresql/org.postgresql

/**
 * Constructor:  Connect to the PostgreSQL back end and return
 * a stream connection.
 *
 * @param host the hostname to connect to
 * @param port the port number that the postmaster is sitting on
 * @exception IOException if an IOException occurs below it.
 */
public PGStream(String host, int port) throws IOException
{
  this.host = host;
  this.port = port;
  changeSocket(new Socket(host, port));
  setEncoding(Encoding.getJVMEncoding("US-ASCII"));
  _int2buf = new byte[2];
  _int4buf = new byte[4];
}
origin: org.ancoron.postgresql/org.postgresql.osgi

stream.changeSocket(newConnection);
origin: org.ancoron.postgresql/org.postgresql

stream.changeSocket(newConnection);
org.postgresql.corePGStreamchangeSocket

Javadoc

Switch this stream to using a new socket. Any existing socket is not closed; it's assumed that we are changing to a new socket that delegates to the original socket (e.g. SSL).

Popular methods of PGStream

  • <init>
    Constructor: Connect to the PostgreSQL back end and return a stream connection.
  • close
    Closes the connection.
  • flush
    Flush any pending output to the backend.
  • getEncoding
  • getSocket
  • hasMessagePending
    Check for pending backend messages without blocking. Might return false when there actually are mess
  • setEncoding
    Change the encoding used by this connection.
  • Receive
    Reads in a given number of bytes from the backend
  • ReceiveChar
    Receives a single character from the backend
  • ReceiveEOF
    Consume an expected EOF from the backend
  • ReceiveInteger2
    Receives a two byte integer from the backend
  • ReceiveInteger4
    Receives a four byte integer from the backend
  • ReceiveInteger2,
  • ReceiveInteger4,
  • ReceiveString,
  • ReceiveTupleV2,
  • ReceiveTupleV3,
  • Send,
  • SendChar,
  • SendInteger2,
  • SendInteger4

Popular in Java

  • Finding current android device location
  • compareTo (BigDecimal)
  • runOnUiThread (Activity)
  • onRequestPermissionsResult (Fragment)
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • JTable (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now