Пример #1
0
List<NetUnitEntry>&
NetLobbyClient::GetUnitMap()
{
    bool request = selected_mission && 
    unit_map.size() < 1 && 
    (NetLayer::GetUTC() - unit_req_time > 2);

    if (selected_mission && GetStatus() == NetServerInfo::ACTIVE && (NetLayer::GetUTC() - unit_req_time > 5))
    request = true;

    if (request) {
        SendData(NET_LOBBY_UNIT_LIST, Text());
        unit_req_time = NetLayer::GetUTC();
    }

    return unit_map;
}
Пример #2
0
//设置接口
bool  CClientKernel::DestroyClientKernel()
{
    SendData(IPC_MIAN_IPC_KERNEL,IPC_SUB_IPC_CLIENT_CLOSE);

    //关闭窗口
    if (m_hWndChannel!=NULL)
    {
        DestroyWindow(m_hWndChannel);
        m_hWndChannel = NULL;
    }

    //设置接口
    m_ClientKernel = NULL;
    m_pIClientKernelSink=NULL;

    std::deque<IPC_Buffer *>::iterator i=m_IPCBuffers.begin();
    for (; i!=m_IPCBuffers.end(); ++i)
    {
        delete (*i);
    }
    m_IPCBuffers.clear();

    for (int i=0; i<MAX_CHAIR; i++)
    {
        if (m_pUserItem[i] != NULL)
        {
            delete m_pUserItem[i];
            m_pUserItem[i] = NULL;
        }
    }

    //共享内存
    if (m_pShareMemory!=NULL)
    {
        UnmapViewOfFile(m_pShareMemory);
        m_pShareMemory=NULL;
    }
    if (m_hShareMemory!=NULL)
    {
        CloseHandle(m_hShareMemory);
        m_hShareMemory=NULL;
    }

    return true;
}
Пример #3
0
ULONG
GetServerTime(LPWSTR lpAddress)
{
    PINFO pInfo;
    LPSTR lpAddr;
    DWORD dwSize = wcslen(lpAddress) + 1;
    ULONG ulTime = 0;

    pInfo = (PINFO)HeapAlloc(GetProcessHeap(),
                             0,
                             sizeof(INFO));
    lpAddr = (LPSTR)HeapAlloc(GetProcessHeap(),
                              0,
                              dwSize);

    if (pInfo && lpAddr)
    {
        if (WideCharToMultiByte(CP_ACP,
                                0,
                                lpAddress,
                                -1,
                                lpAddr,
                                dwSize,
                                NULL,
                                NULL))
        {
            if (InitConnection(pInfo, lpAddr))
            {
                if (SendData(pInfo))
                {
                    ulTime = ReceiveData(pInfo);
                }
            }

            DestroyConnection();
        }
    }

    if (pInfo)
        HeapFree(GetProcessHeap(), 0, pInfo);
    if (lpAddr)
        HeapFree(GetProcessHeap(), 0, lpAddr);

    return ulTime;
}
Пример #4
0
void CentinelaFinalCheck(int CentiIndex) {
	/* '************************************************* */
	/* 'Author: Unknown */
	/* 'Last modified: 02/10/2010 */
	/* 'Al finalizar el tiempo, se retira y realiza la acción pertinente dependiendo del caso */
	/* '03/10/2010: ZaMa - Adaptado para que funcione mas de un centinela en paralelo. */
	/* '************************************************* */

	int UserIndex;
	std::string UserName;

	UserIndex = Centinela[CentiIndex].RevisandoUserIndex;

	if (!UserList[UserIndex].flags.CentinelaOK) {

		UserName = UserList[UserIndex].Name;

		/* 'Logueamos el evento */
		LogCentinela("Centinela ejecuto y echó a " + UserName + " por uso de macro inasistido.");

		/* 'Avisamos a los admins */
		SendData(SendTarget_ToAdmins, 0,
				dakara::protocol::server::BuildConsoleMsg(
						"Servidor> El centinela ha ejecutado a " + UserName + " y lo echó del juego.",
						FontTypeNames_FONTTYPE_SERVER));

		/* ' Evitamos loguear el logout */
		Centinela[CentiIndex].RevisandoUserIndex = 0;

		WriteShowMessageBox(UserIndex, "Has sido ejecutado por macro inasistido y echado del juego.");
		UserDie(UserIndex);
		FlushBuffer(UserIndex);
		CloseSocket(UserIndex);
	}

	Centinela[CentiIndex].clave = 0;
	Centinela[CentiIndex].TiempoRestante = 0;
	Centinela[CentiIndex].RevisandoUserIndex = 0;
	Centinela[CentiIndex].Activo = false;

	if (Centinela[CentiIndex].NpcIndex != 0) {
		QuitarNPC(Centinela[CentiIndex].NpcIndex);
		Centinela[CentiIndex].NpcIndex = 0;
	}
}
Пример #5
0
bool
NetLobbyClient::Login(bool host_req)
{
    Player* player = Player::GetCurrentPlayer();
    if (!player)
    return false;

    host = host_req;

    Text login = "******"";
    login += SafeQuotes(player->Name());
    login += "\" pass \"";
    login += SafeQuotes(player->Password());
    login += "\" version \"";
    login += versionInfo;
    login += "\" ";

    char buffer[256];

    sprintf_s(buffer, "host %s rank %d time %d miss %d kill %d loss %d ", 
    host ? "true" : "false",
    player->Rank(),
    player->FlightTime(),
    player->Missions(),
    player->Kills(),
    player->Losses());

    login += buffer;

    login += "sig \"";
    login += SafeQuotes(player->Signature());
    login += "\" squad \"";
    login += SafeQuotes(player->Squadron());
    login += "\" ";

    if (gamepass.length() > 0) {
        login += "gamepass \"";
        login += SafeQuotes(gamepass);
        login += "\" ";
    }

    SendData(NET_LOBBY_LOGIN, login);
    ExecFrame();
    return true;
}
Пример #6
0
void __fastcall TScreenSpy::GetFirst()
{
    TRect rt;
    int l, t;
    FmsScr->Clear();
    FDC = GetDC(0);
    for (int i = 0; i < BNUMS; i++)
    {
        l = (i % BSIZE) * FBWidth;
        t = (i / BSIZE) * FBHeight;
        BitBlt(FBmps[i]->Canvas->Handle, 0, 0, FBWidth, FBHeight, FDC, l, t, SRCCOPY);
        SetRect(&rt, l, t, l + FBWidth, t + FBHeight);
        FmsScr->WriteBuffer(&rt, sizeof(rt));
        FBmps[i]->SaveToStream(FmsScr);
    }
    ReleaseDC(0, FDC);
    SendData(1);
}
Пример #7
0
void CPeerLink::SendBitField()
{
    string strBitField = m_pPeerManager->GetTorrentTask()->GetTaskStorage()->GetBitField();
    if (strBitField.size() == 0)
    {
        return;
    }

    string strBuff;
    char szHeader[5];
    *((int *)(szHeader)) = htonl( 1 + strBitField.size());
    *((char*)(szHeader + 4)) = 5;

    strBuff.append(szHeader, 5);
    strBuff.append(strBitField.data(), strBitField.size());

    SendData(strBuff.data(), strBuff.size());
}
Пример #8
0
//做庄信息
LRESULT CGameClientDlg::OnBanker(WPARAM wParam, LPARAM lParam)
{
	//删除定时器
	KillGameTimer(IDI_CALL_BANKER);

	//控件处理
	m_GameClientView.m_btBanker.ShowWindow(SW_HIDE);
	m_GameClientView.m_btIdler.ShowWindow(SW_HIDE);

	//设置变量
	CMD_C_CallBanker CallBanker;
	CallBanker.bBanker = (BYTE)wParam;

	//发送信息
	SendData(SUB_C_CALL_BANKER,&CallBanker,sizeof(CallBanker));

	return 0;
}
Пример #9
0
void    DoAdminUserList()
{
  char      *args[3];
  char      *users;
  int       ret;
  
  args[0] = MSS_SFTPUSER;
  args[1] = "list";
  args[2] = NULL;
  users = ExecCommandWithArgs(args, &ret, NULL, 1);
  DEBUG((MYLOG_DEBUG, "[DoAdminUserList]Return:%i Users:%s", ret, users));
  if (ret == 0)
    SendData(bOut, 0, users, strlen(users));
  else
    SendStatus(bOut, 0, SSH2_FX_FAILURE);
  if (users != NULL)
    free(users);
}
Пример #10
0
ssize_t UdpTransport::Read(void* data, size_t length) {
    // Read from the target by sending an empty packet.
    std::string error;
    ssize_t bytes = SendData(kIdFastboot, nullptr, 0, reinterpret_cast<uint8_t*>(data), length,
                             kMaxTransmissionAttempts, &error);

    if (bytes == -1) {
        fprintf(stderr, "UDP error: %s\n", error.c_str());
        return -1;
    } else if (static_cast<size_t>(bytes) > length) {
        // Fastboot protocol error: the target sent more data than our fastboot engine was prepared
        // to receive.
        fprintf(stderr, "UDP error: receive overflow, target sent too much fastboot data\n");
        return -1;
    }

    return bytes;
}
Пример #11
0
//求和按钮
LRESULT CGameClientDlg::OnPeace(WPARAM wParam, LPARAM lParam)
{
	//和棋确认
	int nResult=AfxMessageBox(TEXT("你确实要 [ 和棋 ] 吗?"),MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2);
	if (nResult!=IDYES) return 0;

	//状态判断
	if (m_wCurrentUser==INVALID_CHAIR) return 0;

	//发送消息
	SendData(SUB_C_PEACE_REQ);

	//设置界面
	m_GameClientView.m_btPeace.EnableWindow(FALSE);
	InsertSystemString(TEXT("正在等待对家回应 [ 和棋 ] 请求..."));

	return 0;
}
Пример #12
0
int main()
{
    init_uart0();
    init_timer();
    put_string("\r\n\r\n\r\n\r\nInitialising...\r\n\r\n");
    char dest = 'D';
    char message[1000] = "Hello World!";
    //Above message is 107 characters
    put_number(strlen(message));
    put_string(" character long message reads:\r\n");
    put_string(message);

    int error = SendData(dest, message);
    if (error) put_string("Error sending message");

    while(1);
    return 0;
}
Пример #13
0
int ConnectAndSendRequest(mensagem_s * s)
{
	sock = InitConnection();
	int resultado = ConnectToServer(sock);
	if (resultado == -1)
	{
		fprintf(stdout, "Servico nao disponivel de momento, tente mais tarde!\n");
	}
	else
	{
		fprintf(stdout, "Aguarde por favor...\n");
		SendData(sock, s->buffer, s->size + 3);
		RecvData(sock);
		return 1;
	}
	free(s);
	return 0;
}
Пример #14
0
/******************************* XI2c_Send *********************************
 *  
 * Send data as a master on the IIC bus.  This function sends the data
 * using polled I/O and blocks until the data has been sent.  It only supports
 * 7 bit addressing and non-repeated start modes of operation.  The user is
 * responsible for ensuring the bus is not busy if multiple masters are 
 * present on the bus.
 *
 * @param    BaseAddress contains the base address of the IIC device.
 * @param    Address contains the 7 bit IIC address of the device to send the
 *           specified data to.
 * @param    BufferPtr points to the data to be sent.
 * @param    ByteCount is the number of bytes to be sent.
 *
 * @return   The number of bytes sent.
 *
 ****************************************************************************/
Xuint8 XI2c_Send(Xuint32 BaseAddress, Xuint8 SlaveAddress,
		 Xuint8 *BufferPtr, Xuint8 ByteCount) {

  Xuint8 CtrlReg;

  XI2c_mClearTXFifo(BaseAddress);

  /** Send the device address **/
  XI2c_mSend7BitAddress(BaseAddress, SlaveAddress, XIIC_WRITE_OPERATION);

  /** Enable the device and begin transmitting **/
  CtrlReg = XIIC_CR_ENABLE_DEVICE_MASK | XIIC_CR_MSMS_MASK |
    XIIC_CR_DIR_IS_TX_MASK;
  XIo_Out8(BaseAddress + XIIC_CR_REG_OFFSET, CtrlReg);

  return SendData(BaseAddress, SlaveAddress, BufferPtr, ByteCount);

} // end XI2c_Send()
Пример #15
0
BOOL QMailModule::DoNewMailNotify( KPlayer* pPlayer, KMailListInfo* pMailListInfo )
{
	BOOL						bRetCode	= FALSE;
	S2C_NEW_MAIL_NOTIFY*		pRespond	= (S2C_NEW_MAIL_NOTIFY*)m_byTempData;

	LOG_PROCESS_ERROR(pPlayer);
	LOG_PROCESS_ERROR(pMailListInfo);

	pRespond->byProtocol		= s2c_new_mail_notify;
	pRespond->NewMailListInfo	= *pMailListInfo;

	bRetCode = SendData(pPlayer->GetPlayerIndex(), *pRespond);
	LOG_PROCESS_ERROR(bRetCode);

	bRetCode = TRUE;
EXIT0:
	return bRetCode;
}
Пример #16
0
void SocketHandler::sendMessage(Message2 message)
{
    QByteArray json = net_codec_->fromUnicode(message.json);

    QByteArray data;

    uchar temp[4];

    qToBigEndian(json.size(), temp);
    data.append((char*)temp, 4);

    qToBigEndian(message.type, temp);
    data.append((char*)temp, 4);

    data.append(json);

    SendData(data);
}
Пример #17
0
//定时操作
void CGameClientDlg::OnTimer(UINT nIDEvent)
{
	switch(nIDEvent)
	{
	case IDI_TIME_USER_ADD_SCORE:
		{
			//测试代码
			//m_GameClientView.m_btOpenCard.ShowWindow(SW_SHOW);
			//删除定时器
			KillTimer(IDI_TIME_USER_ADD_SCORE);

			//获取位置
			WORD wMeChairID=GetMeChairID();
			WORD wViewChairID=m_wViewChairID[wMeChairID];

			//控制按钮
			UpdateScoreControl(NULL,SW_HIDE);

			//发送消息
			CMD_C_AddScore AddScore;
			AddScore.lScore=__max(m_lTurnMaxScore/8,1L);
			SendData(SUB_C_ADD_SCORE,&AddScore,sizeof(AddScore));

			//界面设置
			m_lTableScore[wMeChairID]=AddScore.lScore;
			m_GameClientView.SetUserTableScore(wViewChairID,m_lTableScore[wMeChairID]);
			PlayGameSound(AfxGetInstanceHandle(),TEXT("ADD_SCORE"));

			return;
		}
	case IDI_TIME_OPEN_CARD:
		{
			//删除定时器
			KillTimer(IDI_TIME_OPEN_CARD);

			//摊牌
			OnOpenCard(0,0);

			return;
		}
	}

	CGameFrameDlg::OnTimer(nIDEvent);
}
Пример #18
0
//下载文件
BOOL CClientSocket::GetMediaData(DWORD videoID,LPCSTR pszFilePath,CString & strFullPath)
{
    MEDIADATA data = {0};
    data.videoID=videoID;
    if(!SendData(VODNETCMD_MEDIADATA,&data,sizeof(data)))
        return FALSE;
    
    VODHEADER header = {0};
    if(!RecvData(&header,sizeof(header)))
	   return FALSE;
    
    MEDIADATARET dataret = {0};
    if(!RecvData(&dataret,sizeof(dataret)))
		return FALSE;
    if (dataret.dwFileLen==0)
    {
        return TRUE;
    }
    strFullPath = pszFilePath;
	strFullPath+=dataret.szFileName;
    //判断文件是否存在
    BOOL bExit=PathFileExists(strFullPath);
   	if (!SendRaw(&bExit,sizeof(bExit)))return FALSE;
    if (bExit)return TRUE;//文件存在,将不再接收文件内容
    CFile file;
    if(!file.Open(strFullPath,CFile::modeCreate|CFile::modeWrite))
		return FALSE;
        
    CHAR szBuff[2000] = {0};
    LONG nLeft = dataret.dwFileLen;
    while(nLeft>0){
        int nRecv = 2000;
        if (nLeft<nRecv)
        {
            nRecv = nLeft;
        }
        RecvData(szBuff,nRecv);
        file.Write(szBuff,nRecv);
        nLeft = nLeft - nRecv;
    }
    file.Close();

    return TRUE;
}
Пример #19
0
BOOL QMailModule::DoSendMailRespond( KPlayer* pPlayer, int nRespondID, int nResult )
{
	BOOL						bRetCode	= FALSE;
	S2C_SEND_MAIL_RESPOND*		pRespond	= (S2C_SEND_MAIL_RESPOND*)m_byTempData;

	LOG_PROCESS_ERROR(pPlayer);
	LOG_PROCESS_ERROR(nRespondID);

	pRespond->byProtocol	= s2c_send_mail_respond;
	pRespond->byRespondID	= nRespondID;
	pRespond->byResult		= (BYTE)nResult;

	bRetCode = SendData(pPlayer->GetPlayerIndex(), *pRespond);
	LOG_PROCESS_ERROR(bRetCode);
	
	bRetCode = TRUE;
EXIT0:
	return bRetCode;
}
Пример #20
0
BOOL QMailModule::DoMailGeneralRespond( KPlayer* pPlayer, DWORD dwMailID, int nResult )
{
	BOOL							bRetCode		= FALSE;
	S2C_MAIL_GENERAL_RESPOND*		pRespond		= (S2C_MAIL_GENERAL_RESPOND*)m_byTempData;

	LOG_PROCESS_ERROR(pPlayer);
	LOG_PROCESS_ERROR(dwMailID);

	pRespond->byProtocol	= s2c_mail_general_respond;
	pRespond->dwMailID		= dwMailID;
	pRespond->byResult		= (BYTE)nResult;

	bRetCode = SendData(pPlayer->GetPlayerIndex(), *pRespond);
	LOG_PROCESS_ERROR(bRetCode);

	bRetCode = TRUE;
EXIT0:
	return bRetCode;
}
std::string SampleEscrowServerZmq::RequestSignedWithdrawal(const std::string &client)
{
    if(!this->isClient)
        return SampleEscrowServer::RequestSignedWithdrawal(client);

    BtcNetMsgReqSignedTxPtr message = BtcNetMsgReqSignedTxPtr(new BtcNetMsgReqSignedTx());
    memcpy(message->client, client.c_str(), 20);

    BtcNetMsg* rawReply = SendData((BtcNetMsg*)message.get());
    if(rawReply == NULL)
        return std::string();

    BtcNetMsgSignedTxPtr reply = BtcNetMsgSignedTxPtr(new BtcNetMsgSignedTx());
    memcpy(reply->data, rawReply->data, NetMsgSignedTxSize);

    delete[] rawReply;

    return reply->rawTx;
}
u_int64_t SampleEscrowServerZmq::GetClientTransactionCount(const std::string &client)
{
    if(!this->isClient)
        return SampleEscrowServer::GetClientTransactionCount(client);

    BtcNetMsgGetTxCountPtr message = BtcNetMsgGetTxCountPtr(new BtcNetMsgGetTxCount());
    memcpy(message->client, client.c_str(), 20);

    BtcNetMsg* rawReply = SendData((BtcNetMsg*)message.get());
    if(rawReply == NULL)
        return 0;

    BtcNetMsgTxCountPtr reply = BtcNetMsgTxCountPtr(new BtcNetMsgTxCount());
    memcpy(reply->data, rawReply->data, NetMsgTxCountSize);

    delete[] rawReply;

    return reply->txCount;
}
Пример #23
0
unsigned WINAPI RequestHandler(void* arg)
{
	SOCKET hClntSock = (SOCKET)arg;
	char buf[BUF_SIZE] = { 0, };
	char method[BUF_SMALL] = { 0, };
	char ct[BUF_SMALL] = { 0, };
	char fileName[BUF_SMALL] = { 0, };

	if (recv(hClntSock, buf, BUF_SIZE, 0) == SOCKET_ERROR)
		ErrorHandling("[DEBUG]recv() Error");

	if (strstr(buf, "HTTP/") == NULL)
	{
		SendErrorMSG(hClntSock, ERROR_400_BAD_REQUEST);
		closesocket(hClntSock);
		return 1;
	}

	strcpy(method, strtok(buf, " "));
	if (strcmp(method, "GET"))
		SendErrorMSG(hClntSock, ERROR_400_BAD_REQUEST);

	strcpy(fileName, strtok(NULL, " "));
	memmove(fileName + 1, fileName, strlen(fileName));
	fileName[0] = '.';
	for (unsigned int i = 0; i < strlen(fileName) + 1; ++i)
	{
		if (fileName[i] == '/')
			fileName[i] = '\\';
	}

	char* type = ContentType(fileName);
	if (type == NULL)
	{
		SendErrorMSG(hClntSock, ERROR_404_NOT_FOUND);
		closesocket(hClntSock);
		return 0;
	}

	strcpy(ct, ContentType(fileName));
	SendData(hClntSock, ct, fileName);
	return 0;
}
std::string SampleEscrowServerZmq::GetPubKey(const std::string &client)
{
    if(!this->isClient)
        return SampleEscrowServer::GetPubKey(client);

    BtcNetMsgGetKeyPtr msg = BtcNetMsgGetKeyPtr(new BtcNetMsgGetKey());
    memcpy(msg->client, client.c_str(), 20);

    BtcNetMsg* rawReply = SendData((BtcNetMsg*)msg.get());
    if(rawReply == NULL)
        return std::string();

    BtcNetMsgPubKeyPtr reply = BtcNetMsgPubKeyPtr(new BtcNetMsgPubKey());
    memcpy(reply->data, rawReply->data, NetMsgPubKeySize);

    delete[] rawReply;

    return reply->pubKey;
}
Пример #25
0
int main()
{
	unsigned int data=0;
	DDRD=0x07;	//PD0-PD2 как выход
	PORTD=0x00;	//ѕервоначально выключаем выход
	
	while(1)
	{
		_delay_ms(250);
		PORTB |= (1 << 0);

		SendData(data);	
		data=data+1;	
		_delay_ms(250);	
		PORTB &= ~(1 << 0);
	
	}
	return 1;
}
Пример #26
0
void Point(uchar x,uchar y,uchar *buf)
{
uchar xx,yy;
uint16 dd=0;
x=x%128;
y=y%64;
xx=x/16;
yy=63-y;
dd=((uint16)buf[x/16*2+yy*16])<<8;
dd|=buf[x/16*2+1+yy*16];
if(yy>=32){xx=xx+8;yy-=32;}
dd|=0x8000>>(x%16);
buf[x/16*2+yy*16]=dd>>8;
buf[x/16*2+1+yy*16]=dd;
SendCMD(0x80+yy);
SendCMD(0x80+xx);
SendData(dd>>8);
SendData(dd);
}
Пример #27
0
///////////////////////////
///@breif output character reload
///@param val the integer value that will be print to USART as characters
///////////////////////////
USART& USART::operator<<(int val)
{
    u8 sign = 0, len = 0,data[10];
    if(val<0)
    {
        sign = 1;
        val = -val;
    }
    do
    {
        len++;
        data[10-len] = val%10 + '0';
        val = val/10;
    } while(val);
    if(sign==1)
        data[10-(++len)] = '-';
    SendData(data+10-len,len);
    return *this;
}
Пример #28
0
int main()
{
    char szBuf[MAX_BUF_LEN] = "\0";
    int size = MAX_BUF_LEN;
    char szReplyMsg[MAX_BUF_LEN] = "hi\0";
    tServiceHandler h = -1;
    InitializeNetService(IP_ADDR,PORT);
    while(1)
    {
        h = ServiceStart();
        RecvData(h, szBuf, &size);
        printf("server recv:%s\n", szBuf);
        SendData(h, szReplyMsg, strlen(szReplyMsg));
        printf("server send:%s\n", szReplyMsg);
        ServiceStop(h);
    }
    ShutdownNetService();
    return 0;
}
Пример #29
0
static void GetFilesAndSpool(char *datadir)
// GFAS assumes we are cd'd into the data subdirectory (main does this)
{
    struct direct **nameList;
    int numfiles = scandir(".", &(nameList), (PFI)ScreenForData, NULL);
    if (numfiles == 0) {
        LogMsg(20, LogLevel, LogFile, "No data to spool in directory %s",
               datadir);
        return;
    }
    LogMsg(100, LogLevel, LogFile, "GFAS: Found %d data files", numfiles);

    for (int i = 0; i < numfiles; i++) {
        LogMsg(100, LogLevel, LogFile, "GFAS: Sending %s/%s", datadir,
               nameList[i]->d_name);
        SendData(nameList[i]->d_name);
    }
    //    UpdateDB();
}
int64_t SampleEscrowServerZmq::GetClientBalance(const std::string &client)
{
    if(!this->isClient)
        return SampleEscrowServer::GetClientBalance(client);

    BtcNetMsgGetBalancePtr message = BtcNetMsgGetBalancePtr(new BtcNetMsgGetBalance());
    memcpy(message->client, client.c_str(), 20);

    BtcNetMsg* rawReply = SendData((BtcNetMsg*)message.get());
    if(rawReply == NULL)
        return int64_t(0);

    BtcNetMsgBalancePtr reply = BtcNetMsgBalancePtr(new BtcNetMsgBalance());
    memcpy(reply->data, rawReply->data, NetMsgBalanceSize);

    delete[] rawReply;

    return reply->balance;
}