This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pxz-hos-client-cpp-module/example/single_thread.cpp

37 lines
1.0 KiB
C++
Raw Normal View History

2020-09-11 16:13:02 +08:00
/*************************************************************************
> File Name: single_thread.cpp
> Author: pxz
> Created Time: Fri 11 Sep 2020 09:52:05 AM CST
************************************************************************/
#include<stdio.h>
#include<unistd.h>
2020-09-11 16:13:02 +08:00
#include"../src/hos_client.h"
int main(int argc, char *argv[])
{
char *bucket = argv[1];
printf("hos_client_init start ...\n");
hos_client_handle handle = hos_client_init("http://192.168.44.12:9098/hos", "default", "default");
2020-09-11 16:13:02 +08:00
if (handle == NULL)
{
printf("error:hos_client_handle\n");
return -1;
}
printf("hos_client_init success ...");
2020-09-11 16:13:02 +08:00
printf("hos_create_bucket start ... \n");
if(!hos_create_bucket(handle, bucket))
{
printf("hos_create_bucket failed ... \n");
}
printf("hos_create_bucket success ... \n");
2020-09-11 16:13:02 +08:00
printf("hos_upload_async start ...\n");
hos_upload_async(handle, bucket, "my-file.txt");
2020-09-11 16:13:02 +08:00
//sleep(30);
2020-09-11 16:13:02 +08:00
hos_client_close(handle);
return 0;
}