Modified recv() method to use snprintf for automatic null terminating strings