VixDiskLib_Write() writes one or more sectors to an open virtual disk. This function expects the fourth parameter buf to be VIXDISKLIB_SECTOR_SIZE bytes long.

vixError = VixDiskLib_Write(newDisk.Handle(), i, j, buf);

In vSphere 6.7 and later, you can improve performance of NBD transport with asynchronous writes. Your program VixDiskLib_WriteAsync in a loop, then calls VixDiskLib_Wait to let all asynchronous writes complete.

// customized callback for complete notification
void myDiskLibCompletion(void *cbData, VixError result);
// a loop for multiple write requests
for (...)
   vixError = VixDiskLib_WriteAsync(newDisk.Handle(), i, j, buf, myDiskLibCompletion, cbData);
   if (vixError != VIX_ASYNC) {
      // handle error
   }
}
VixDiskLib_Wait(newDisk.Handle()); // wait for async write to complete