nsISocketProvider

This interface represents a socket provider. It is implemented by several types of socket classes like: UDP, SOCKS, TLS, SSL, and so on.
Inherits from: nsISupports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0)

Implemented by: @mozilla.org/network/socket;2?type=foo. To create an instance, use:

var socketProvider = Components.classes["@mozilla.org/network/socket;2?type="]
                     .createInstance(Components.interfaces.nsISocketProvider);

Method overview

void addToSocket(in long aFamily, in string aHost, in long aPort, in string aProxyHost, in long aProxyPort, in unsigned long aFlags, in PRFileDescStar aFileDesc, out nsISupports aSecurityInfo); Native code only!
void newSocket(in long aFamily, in string aHost, in long aPort, in string aProxyHost, in long aProxyPort, in unsigned long aFlags, out PRFileDescStar aFileDesc, out nsISupports aSecurityInfo); Native code only!

Constants

Constant Value Description
PROXY_RESOLVES_HOST 1 << 0 This flag is set if the proxy is to perform hostname resolution instead of the client. When set, the hostname parameter passed in this interface will be used instead of the address structure passed for a later request.
ANONYMOUS_CONNECT 1 << 1 When setting this flag, the socket will not apply any credentials when establishing a connection. For example, an SSL connection would not send any client-certificates if this flag is set.

Methods

Native code only!

addToSocket

This function is called to allow the socket provider to layer a PRFileDesc (a file descriptor) on top of another PRFileDesc. For example, SSL via a SOCKS proxy.

Parameters are the same as newSocket() with the exception of aFileDesc, which is an input parameter instead.

void addToSocket(
  in long aFamily,
  in string aHost,
  in long aPort,
  in string aProxyHost,
  in long aProxyPort,
  in unsigned long aFlags,
  in PRFileDescStar aFileDesc,
  out nsISupports aSecurityInfo
);
Parameters
aFamily
The address family for this socket (PR_AF_INET or PR_AF_INET6).
aHost
The hostname for this connection.
aPort
The port for this connection.
aProxyHost
If non-null, the proxy hostname for this connection.
aProxyPort
The proxy port for this connection.
aFlags
Control flags that govern this connection (see Constants).
aFileDesc
The existing PRFileDesc.
aSecurityInfo
Any security info that should be associated with aFileDesc. This object typically implements nsITransportSecurityInfo.

Native code only!

newSocket

Creates a new socket.

void newSocket(
  in long aFamily,
  in string aHost,
  in long aPort,
  in string aProxyHost,
  in long aProxyPort,
  in unsigned long aFlags,
  out PRFileDescStar aFileDesc,
  out nsISupports aSecurityInfo
);
Parameters
aFamily
The address family for this socket (PR_AF_INET or PR_AF_INET6).
aHost
The hostname for this connection.
aPort
The port for this connection.
aProxyHost
If non-null, the proxy hostname for this connection.
aProxyPort
The proxy port for this connection.
aFlags
Control flags that govern this connection (see Constants)
aFileDesc
The resulting PRFileDesc.
aSecurityInfo
Any security info that should be associated with aFileDesc. This object typically implements nsITransportSecurityInfo.

See also