• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
PlainSocketFactory Class Reference

The default class for creating sockets. More...

Inheritance diagram for PlainSocketFactory:
SocketFactory

Description

Author
Roland Weber
Michael Becke

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Public Member Functions

Socket createSocket ()
 Creates a new, unconnected socket. More...
 
Socket connectSocket (Socket sock, String host, int port, InetAddress localAddress, int localPort, HttpParams params) throws IOException
 Connects a socket to the given host. More...
 
final boolean isSecure (Socket sock) throws IllegalArgumentException
 Checks whether a socket connection is secure. More...
 
boolean equals (Object obj)
 Compares this factory with an object. More...
 
int hashCode ()
 Obtains a hash code for this object. More...
 

Static Public Member Functions

static PlainSocketFactory getSocketFactory ()
 Gets the singleton instance of this class. More...
 

Member Function Documentation

◆ getSocketFactory()

static PlainSocketFactory getSocketFactory ( )
static
Returns
the one and only plain socket factory

◆ createSocket()

Socket createSocket ( )
Returns
a new socket
Exceptions
IOExceptionif an I/O error occurs while creating the socket

Implements SocketFactory.

◆ connectSocket()

Socket connectSocket ( Socket  sock,
String  host,
int  port,
InetAddress  localAddress,
int  localPort,
HttpParams  params 
) throws IOException
Parameters
sockthe socket to connect, as obtained from createSocket . null indicates that a new socket should be created and connected.
hostthe host to connect to
portthe port to connect to on the host
localAddressthe local address to bind the socket to, or null for any
localPortthe port on the local machine, 0 or a negative number for any
paramsadditional parameters for connecting
Returns
the connected socket. The returned object may be different from the sock argument if this factory supports a layered protocol.
Exceptions
IOExceptionif an I/O error occurs
UnknownHostExceptionif the IP address of the target host can not be determined
ConnectTimeoutExceptionif the socket cannot be connected within the time limit defined in the params

Implements SocketFactory.

◆ isSecure()

final boolean isSecure ( Socket  sock) throws IllegalArgumentException

This factory creates plain socket connections which are not considered secure.

Parameters
sockthe connected socket
Returns
false
Exceptions
IllegalArgumentExceptionif the argument is invalid

Implements SocketFactory.

◆ equals()

boolean equals ( Object  obj)

There is only one instance of this class.

Parameters
objthe object to compare with
Returns
iff the argument is this object

◆ hashCode()

int hashCode ( )

All instances of this class have the same hash code. There is only one instance of this class.