BurstFS_Server/burstfs_sock.c
int sock_init_server(int local_rank_idx) {
	int rc;

    char tmp_str[GEN_STR_LEN];

    sprintf(tmp_str, "%s%d", DEF_SOCK_PATH, local_rank_idx);
	server_sockfd = socket(AF_UNIX, SOCK_STREAM, 0);

    memset(&server_address, 0, sizeof(server_address));
    server_address.sun_family = AF_UNIX;
    strcpy(server_address.sun_path, tmp_str);
    int server_len = sizeof(server_address);
	unlink(tmp_str);

    rc = bind(server_sockfd, (struct sockaddr *)&server_address,\
    		(socklen_t)server_len);
    if (rc != 0)
    	return -1;

    rc = listen(server_sockfd, MAX_NUM_CLIENTS);
    if (rc != 0)
    	return -1;

	int flag = fcntl(server_sockfd, F_GETFL);
    fcntl(server_sockfd, F_SETFL, flag|O_NONBLOCK);
    poll_set[0].fd = server_sockfd; //add
    poll_set[0].events = POLLIN|POLLHUP;
    poll_set[0].revents = 0;
    num_fds++;

    return 0;


}
/**
* initialize the listening socket on this delegator
* @return success/error code
*/
initialize the listening socket on this delegator
initialize the listening socket on this delegator
int sock_init_server(int local_rank_idx) {
	int rc;
    char tmp_str[GEN_STR_LEN];
    sprintf(tmp_str, "%s%d", DEF_SOCK_PATH, local_rank_idx);
	server_sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
    memset(&server_address, 0, sizeof(server_address));
    server_address.sun_family = AF_UNIX;
    strcpy(server_address.sun_path, tmp_str);
    int server_len = sizeof(server_address);
	unlink(tmp_str);
    rc = bind(server_sockfd, (struct sockaddr *)&server_address,\
    		(socklen_t)server_len);
    if (rc != 0)
    	return -1;
    rc = listen(server_sockfd, MAX_NUM_CLIENTS);
    if (rc != 0)
    	return -1;
	int flag = fcntl(server_sockfd, F_GETFL);
    fcntl(server_sockfd, F_SETFL, flag|O_NONBLOCK);
    poll_set[0].fd = server_sockfd; 
    poll_set[0].events = POLLIN|POLLHUP;
    poll_set[0].revents = 0;
    num_fds++;
    return 0;
}
int sock_init_server ( int local_rank_idx ) { int rc ; char tmp_str [ GEN_STR_LEN ] ; sprintf ( tmp_str , " " , DEF_SOCK_PATH , local_rank_idx ) ; server_sockfd = socket ( AF_UNIX , SOCK_STREAM , 0 ) ; memset ( & server_address , 0 , sizeof ( server_address ) ) ; server_address . sun_family = AF_UNIX ; strcpy ( server_address . sun_path , tmp_str ) ; int server_len = sizeof ( server_address ) ; unlink ( tmp_str ) ; rc = bind ( server_sockfd , ( struct sockaddr * ) & server_address , ( socklen_t ) server_len ) ; if ( rc != 0 ) return -1 ; rc = listen ( server_sockfd , MAX_NUM_CLIENTS ) ; if ( rc != 0 ) return -1 ; int flag = fcntl ( server_sockfd , F_GETFL ) ; fcntl ( server_sockfd , F_SETFL , flag | O_NONBLOCK ) ; poll_set [ 0 ] . fd = server_sockfd ; poll_set [ 0 ] . events = POLLIN | POLLHUP ; poll_set [ 0 ] . revents = 0 ; num_fds ++ ; return 0 ; }
initialize the listening socket on this delegator
initialize the listening socket on this delegator
//add
