The default class for creating sockets. More...
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... | |
|
static |
Socket createSocket | ( | ) |
IOException | if an I/O error occurs while creating the socket |
Implements SocketFactory.
Socket connectSocket | ( | Socket | sock, |
String | host, | ||
int | port, | ||
InetAddress | localAddress, | ||
int | localPort, | ||
HttpParams | params | ||
) | throws IOException |
sock | the socket to connect, as obtained from createSocket . null indicates that a new socket should be created and connected. |
host | the host to connect to |
port | the port to connect to on the host |
localAddress | the local address to bind the socket to, or null for any |
localPort | the port on the local machine, 0 or a negative number for any |
params | additional parameters for connecting |
sock
argument if this factory supports a layered protocol.IOException | if an I/O error occurs |
UnknownHostException | if the IP address of the target host can not be determined |
ConnectTimeoutException | if the socket cannot be connected within the time limit defined in the params |
Implements SocketFactory.
final boolean isSecure | ( | Socket | sock | ) | throws IllegalArgumentException |
This factory creates plain socket connections which are not considered secure.
sock | the connected socket |
false
IllegalArgumentException | if the argument is invalid |
Implements SocketFactory.
boolean equals | ( | Object | obj | ) |
There is only one instance of this class.
obj | the object to compare with |
int hashCode | ( | ) |
All instances of this class have the same hash code. There is only one instance of this class.