if (!gOTInitialized) _MD_FinishInitNetAccess();
PRInt32 _MD_socket(int domain, int type, int protocol){    OSStatus    err;    EndpointRef endpoint;    // We only deal with internet domain    if (domain != AF_INET) {        err = kEPROTONOSUPPORTErr;        goto ErrorExit;    }        // We only know about tcp & udp    if ((type != SOCK_STREAM) && (type != SOCK_DGRAM)) {        err = kEPROTONOSUPPORTErr;        goto ErrorExit;    }        // Convert default types to specific types.    if (protocol == 0)  {        if (type == SOCK_DGRAM)            protocol = IPPROTO_UDP;        else if (type == SOCK_STREAM)            protocol = IPPROTO_TCP;    }        // Only support default protocol for tcp    if ((type == SOCK_STREAM)  && (protocol != IPPROTO_TCP)) {        err = kEPROTONOSUPPORTErr;        goto ErrorExit;    }                    // Only support default protocol for udp    if ((type == SOCK_DGRAM)  && (protocol != IPPROTO_UDP)) {        err = kEPROTONOSUPPORTErr;        goto ErrorExit;    }            // Create a socket, we might run out of memory    err = CreateSocket(type, &endpoint);    if (err != kOTNoError)        goto ErrorExit;    PR_ASSERT((PRInt32)endpoint != -1);    return ((PRInt32)endpoint);ErrorExit:    macsock_map_error(err);    return -1;}