nsISupports Last changed in Gecko 1.9 (Firefox 3)Implemented by: @mozilla.org/network/socket-transport-service;1. To create an instance, use:
var socketTransportService = Components.classes["@mozilla.org/network/socket-transport-service;1"]
.getService(Components.interfaces.nsISocketTransportService);
void attachSocket(in PRFileDescPtr aFd, in nsASocketHandlerPtr aHandler); Native code only! |
nsISocketTransport createTransport(in Array<ACString> aSocketTypes, in AUTF8String aHost, in long aPort, in nsIProxyInfo aProxyInfo); |
void init(); Obsolete since Gecko 1.8 |
void notifyWhenCanAttachSocket(in nsIRunnable aEvent); Native code only! |
void shutdown(); Obsolete since Gecko 1.8 |
| Attribute | Type | Description |
autodialEnabled |
boolean |
controls whether or not the socket transport service should poke the autodialer on connection failure. Obsolete since Gecko 1.8 |
Adds a new socket to the list of controlled sockets.
This will fail with the error code NS_ERROR_NOT_AVAILABLE if the maximum number of sockets is already reached. In this case, the notifyWhenCanAttachSocket() method should be used.
void attachSocket( in PRFileDescPtr aFd, in nsASocketHandlerPtr aHandler );
aFdaHandlerCreates a transport for a specified host and port.
nsISocketTransport createTransport( in Array<ACString> aSocketTypes, in AUTF8String aHost, in long aPort, in nsIProxyInfo aProxyInfo );
aSocketTypes"starttls", "ssl" and "udp" are supported. Pass an empty array [] if the default socket type should be used. You do not need to specify the strings "socks" or "socks4", use the aProxyInfo instead.aHostaPortaProxyInfonull if no proxy should be used.nsIProxiedProtocolHandler , nsIProtocolProxyService or Proxies in Necko.An nsISocketTransport containing the SocketTransport.
void init();
None.
If the number of sockets reaches the limit, then consumers can be notified when the number of sockets becomes less than the limit. The notification is asynchronous, delivered via the given nsIRunnable instance on the socket transport thread.
void notifyWhenCanAttachSocket( in nsIRunnable aEvent );
aEventvoid shutdown();
None.
// at first, we need a nsISocketTransportService ....
var transportService =
Components.classes["@mozilla.org/network/socket-transport-service;1"]
.getService(Components.interfaces.nsISocketTransportService);
// ... then it is time to create the transport. It will connect to ...
// ... mozilla.org:2000 with TLS support and default proxy settings
var socket = transportService.createTransport(["starttls"], 1,"mozilla.org", 2000, null);