I was wondering if it's possible to create a
(scriptable) UDP/IP (datagram) socket with NetLib?
Upon a cursory inspection of the code, particularly
the nsSocketTransportService::CreateTransportOfTypes()
method and related classes, it would appear that
it's only possible to create TCP/IP sockets, or
variants: tcp+SSL, tcp+TLS, tcp+SOCKS, tcp+SOCKS4.
Is that the case? And if it is, should I file an
RFE? I believe there is a portable runtime function
for creating a UDP socket, PR_NewUDPSocket(), but
I'm not sure how much more infrastructure would be
needed to support the use of datagrams in a Mozilla
extension.
Any help would be appreciated.
Thanks,
Charles
yup, this is a legitimate feature request. you can work around the
limitations of necko by registering your own nsISocketProvider. check
out the nsISocketProviderService for more details.
if you register a socket provider under the string "my-socket-type", and
if you pass this string to the CreateTransportOfType method on
nsISocketTransport, the socket transport code will call your socket
provider's NewSocket instead of the default PR_NewTCPSocket(). iow, you
can just make your socket provider call PR_NewUDPSocket() and return that.
darin
This is code from about a year ago when I was playing around with UDP
applications and Mozilla. I would be surprised if this complied out of
the box.
one you get it compiling, you need to register this component with the
contract id that is specified in nsISocketProvider.
If you have question, please ask.
Doug Turner
do...@netscape.com