libs/nameserver/src/nameServCalls.cxx
//---------------------------------------------------------------------------------------------
// This function gets string from socket. It receives the length of message at first and 
// then allocates necessary amount of memory for string and copies received command to
// this memory.
//---------------------------------------------------------------------------------------------
This function gets string from socket. It receives the length of message at first and
then allocates necessary amount of memory for string and copies received command to
this memory.
This function gets string from socket . It receives the length of message at first and then allocates necessary amount of memory for string and copies received command to this memory .
char* ReceiveString(int socket) {
    static char* data=NULL;;
    int len;
    int rc = ReceiveInteger(socket, &len);
    if(rc<=0) 
        return NULL;
    if(data!=NULL) 
        delete data;
    data = new char [len+1];
    rc = ReceiveBuffer(socket, data, len);
    if(rc<=0) 
        return NULL;
    data[len]=0;
    _DBG(fprintf(log_fd, "\n<RECEIVE>\n"));
    _DBG(fprintf(log_fd, "%s", data));
    _DBG(fprintf(log_fd, "\n</RECEIVE>\n\n"));
    return data;
}
char * ReceiveString ( int socket ) { static char * data = NULL ; ; int len ; int rc = ReceiveInteger ( socket , & len ) ; if ( rc <= 0 ) return NULL ; if ( data != NULL ) delete data ; data = new char [ len + 1 ] ; rc = ReceiveBuffer ( socket , data , len ) ; if ( rc <= 0 ) return NULL ; data [ len ] = 0 ; _DBG ( fprintf ( log_fd , " \n \n " ) ) ; _DBG ( fprintf ( log_fd , " " , data ) ) ; _DBG ( fprintf ( log_fd , " \n \n \n " ) ) ; return data ; }
This function gets string from socket.
This function gets string from socket .