#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <time.h>
#include <arpa/inet.h>
#include <iconv.h>
#include <pthread.h>
#include <locale.h>
#include <signal.h>

#define DEF_EMPTY_DATA			3
#define DEF_DATA_RECEIVE_FINISH		2
#define DEF_SUB_DATA_SUCCESS		1
#define DEF_RESULT_DATA_SUCCESS		0
#define DEF_DATA_ERROR			-1
#define DEF_NO_DATA_RECEIVED		-2

#define MULAW				1
#define ALAW				2
#define WAV				3
#define PCM				4

#define NO_UTF8_Encoding		0
#define UTF8_Encoding			1

int VST_Connect_To_Server(const char *host, const char *port);
int First_Send_Data(int sockfd, char *key);
void VST_Close(int sockfd);
void Last_Send_Data(int sockfd);
void Send_Voice_Data(int sockfd, int type, const char *payload, unsigned int length);
//int Recv_Recog_Data(int sockfd, int opt, char *result, int *length, FILE *output);
int Recv_Recog_Data(int sockfd, int opt, char *result, int *length);