socket c语言程序 c/s tcp模式 (程序部分1)

程序:

dbs_common.h

/*-----------------------------------------------------------------------------
COPYRIGHT MIMO9527

------------------------------------------------------------------------------*/
/******************************************************************************* /
文件名: distributed_banking_system.h
注释:    公用的宏、ENUM定义
作者:    MIMO9527
创建日期:2010-10-16
修改记录:
/ *******************************************************************************/
#ifndef _DBS_DISTRIBUTED_BANKING_SYSTEM_H_
#define _DBS_DISTRIBUTED_BANKING_SYSTEM_H_

#include "dbs_common.h"

#define DBS_MAX_ACCOUNT_NUMBER 1000

 

/************************************************************************/
/* 消息名称定义                                                         */
/************************************************************************/
/*********CLIENT-->SERVER************************************************/
#define CLIENT_SERVER_ACCOUNT_INQUIRY_REQ    0xF000A201
#define CLIENT_SERVER_ACCOUNT_DEPOSIT_REQ    0xF000A202
#define CLIENT_SERVER_ACCOUNT_WITHDRAW_REQ    0xF000A203
#define CLIENT_SERVER_ACCOUNT_TRANSACTION_END_IND 0xF000A204

/*********SERVER-->CLIENT************************************************/
#define SERVER_CLIENT_ACCOUNT_INQUIRY_RSP    0xF000B101
#define SERVER_CLIENT_ACCOUNT_DEPOSIT_RSP    0xF000B102
#define SERVER_CLIENT_ACCOUNT_WITHDRAW_RSP    0xF000B103


/************************************************************************/
/*   账户结构                                                           */
/************************************************************************/
typedef struct _DBS_USER_ACCOUNT_RECORD_STRUCT_
{
UINT32 uiAccountId;
UINT32 uiBalance;
UINT32 uiSockConnId;
HANDLE hMutex;
}DBS_USER_ACCOUNT_RECORD_STRUCT;


/************************************************************************/
/* server context                                                       */
/************************************************************************/
typedef struct _DBS_BANKING_SERVER_CONTEXT_STRUCT_
{
UINT32 uiAccountNumber;
DBS_USER_ACCOUNT_RECORD_STRUCT astAccountRecord[DBS_MAX_ACCOUNT_NUMBER];
}DBS_BANKING_SERVER_CONTEXT_STRUCT;

/************************************************************************/
/* client context                                                       */
/************************************************************************/
typedef struct _DBS_ATM_CLIENT_CONTEXT_STRUCT_
{
UINT32 uiAtmId;
UINT32 uiSockConnId;
UINT32 uiAccountId;
}DBS_ATM_CLIENT_CONTEXT_STRUCT;

/************************************************************************/
/* transaction type                                                     */
/************************************************************************/
typedef enum _DBS_TRANSACTION_TYPE_ENUM_
{
TRANSACTION_TYPE_INQUIRY =1,
TRANSACTION_TYPE_WITHDRAW = 2,
TRANSACTION_TYPE_DEPOSIT =3,
TRANSACTION_TYPE_DEFAULT = 4
}DBS_TRANSACTION_TYPE_ENUM;


/************************************************************************/
/* 消息结构定义                                                         */
/************************************************************************/

/************************************************************************/
/* CLIENT-->SERVER   inquiry request                                   */
/************************************************************************/
typedef struct _DBS_CLIENT_SERVER_ACCOUNT_INQUIRY_REQ_MSG_STRUCT_
{
UINT32      uiMessageType;
UINT32      uiAtmId;
UINT32      uiAccountId;
}DBS_CLIENT_SERVER_ACCOUNT_INQUIRY_REQ_MSG_STRUCT;

/************************************************************************/
/* SERVER-->CLIENT inquiry response                                   */
/************************************************************************/
typedef struct _DBS_SERVER_CLIENT_ACCOUNT_INQUIRY_RSP_MSG_STRUCT_
{
UINT32      uiMessageType;
UINT32      uiAccountId;
UINT32      uiBalance;
    INT32       iResult;    /* DBS_SUCCESS, DBS_FAIL */  
}DBS_SERVER_CLIENT_ACCOUNT_INQUIRY_RSP_MSG_STRUCT;

/************************************************************************/
/* CLIENT-->SERVER   Deposit request                                   */
/************************************************************************/
typedef struct _DBS_CLIENT_SERVER_ACCOUNT_DEPOSIT_REQ_MSG_STRUCT_
{
UINT32      uiMessageType;
UINT32      uiAtmId;
UINT32      uiAccountId;
UINT32      uiAmount;
}DBS_CLIENT_SERVER_ACCOUNT_DEPOSIT_REQ_MSG_STRUCT;

/************************************************************************/
/* SERVER-->CLIENT Deposit response                                   */
/************************************************************************/
typedef struct _DBS_SERVER_CLIENT_ACCOUNT_DEPOSIT_RSP_MSG_STRUCT_
{
UINT32      uiMessageType;
UINT32      uiAccountId;
    INT32       iResult;    /* DBS_SUCCESS, DBS_FAIL */  
}DBS_SERVER_CLIENT_ACCOUNT_DEPOSIT_RSP_MSG_STRUCT;

/************************************************************************/
/* CLIENT-->SERVER   Withdraw request                                   */
/************************************************************************/
typedef struct _DBS_CLIENT_SERVER_ACCOUNT_WITHDRAW_REQ_MSG_STRUCT_
{
UINT32      uiMessageType;
UINT32      uiAtmId;
UINT32      uiAccountId;
UINT32      uiAmount;
}DBS_CLIENT_SERVER_ACCOUNT_WITHDRAW_REQ_MSG_STRUCT;

/************************************************************************/
/* SERVER-->CLIENT Withdraw response                                   */
/************************************************************************/
typedef struct _DBS_SERVER_CLIENT_ACCOUNT_WITHDRAW_RSP_MSG_STRUCT_
{
UINT32      uiMessageType;
UINT32      uiAccountId;
    INT32       iResult;    /* DBS_SUCCESS, DBS_FAIL */  
}DBS_SERVER_CLIENT_ACCOUNT_WITHDRAW_RSP_MSG_STRUCT;


/************************************************************************/
/* CLIENT-->SERVER transaction end ind                                 */
/************************************************************************/
typedef struct _DBS_CLIENT_SERVER_ACCOUNT_TRANSACTION_END_IND_MSG_STRUCT_
{
UINT32      uiMessageType;
UINT32      uiAtmId;
UINT32      uiAccountId;
}DBS_CLIENT_SERVER_ACCOUNT_TRANSACTION_END_IND_MSG_STRUCT;


/************************************************************************/
/* 函数声明                                                             */
/************************************************************************/
void dbs_BankingServer(void);
void dbs_ATM_client(void);

#endif

/************************************END OF FILE********************************/

 

dbs_common.h

/*-----------------------------------------------------------------------------
COPYRIGHT MIMO9527
------------------------------------------------------------------------------*/
/******************************************************************************* /
文件名: common.h
注释:    公用的宏、ENUM定义
作者:    MIMO9527
创建日期:2010-10-16
修改记录:
/ *******************************************************************************/

#ifndef _DBS_COMMON_H_
#define _DBS_COMMON_H_

#pragma comment(lib, "ws2_32.lib")
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <winbase.h>
#include <winsock.h>
#include <errno.h>
#include <time.h>
#include <process.h>


/************************************************************************/
/*      var type define                                                 */
/************************************************************************/

typedef int                    INT32;
typedef unsigned int           UINT32;
typedef short int              INT16;
typedef unsigned short int     UINT16;
typedef signed char            INT8;
typedef unsigned char          UINT8;
typedef UINT8                  DBS_BOOL;
/*DBs return value type define */
typedef INT32 DBS_RET_CODE;

/************************************************************************/
/*    micro define                                                      */
/************************************************************************/
/*dbs null point define*/
#define DBS_NULL (void *)0

/*dbs bool type define*/
#define DBS_TRUE   1
#define DBS_FALSE 0

 

/* dbs return value define */
#define DBS_SUCCESS         0
#define DBS_FAIL           -1

#define DBS_LOG_INFO_MAX_LENGTH   256

#define DBS_MAX_BUFFER_LENGTH     256

#define DBS_ERROR_LOGGING guc_DbsFileName = (UINT8 *)__FILE__; gui_DbsFileLine = __LINE__; dbs_Error_Logging
#define DBS_DEBUG_LOGGING dbs_Debug_Logging

/************************************************************************/
/*                                                                      */
/************************************************************************/
extern UINT8 *guc_DbsFileName;
extern UINT32 gui_DbsFileLine;
extern UINT8   guc_SprintBuf[DBS_LOG_INFO_MAX_LENGTH];

extern INT32   giForTest;

/************************************************************************/
/* 函数声明                                                             */
/************************************************************************/
void dbs_Debug_Logging(char *vpucFormat, ...);
void dbs_Error_Logging(char *vpucFormat, ...);

DBS_RET_CODE Dbs_InitSocket(UINT16 vusPortId,INT32 *vpiSockId,struct sockaddr_in *vpstHostAddr);

 

#endif

/************************************END OF FILE********************************/

 

1.c

/*************************************************************************
* COPYRIGHT MIMO9527                                                  *
**************************************************************************
* 文件名   :           
* 功能     :
* 版本     : v1.0                                                                
* 编写日期 : 10/16/2010              
* 说明     : 描述使用文件功能时的制约条件                                      
* 修改历史 :
*
*   修改人 日期 内容
* ------------------------------------------------------------------------
*   MIMO9527 2010-10-16 创建
*************************************************************************/
#include "dbs_distributed_banking_system.h"

DBS_ATM_CLIENT_CONTEXT_STRUCT gstAtmClientCtx ;

INT32 giForTest = 0;

/*******************************************************************************
* name          :
* description   :
* storage style :
* parameters    :
* parameter style              input/output description
* --------- ----------------- ------------ --------------------------
*
* -----------------------------------------------------------------------------
* comments      :
*******************************************************************************/
void dbs_InitAtmClientContext(void)
{
memset(&gstAtmClientCtx,0,sizeof(DBS_ATM_CLIENT_CONTEXT_STRUCT));
return;
}

/*******************************************************************************
* name          :
* description   :
* storage style :
* parameters    :
* parameter style              input/output description
* --------- ----------------- ------------ --------------------------
*
* -----------------------------------------------------------------------------
* comments      :
*******************************************************************************/
void dbs_AtmClientSendMsg2Server(void *vpstMsg,UINT32 vuiMsgLen)
{
//向服务器发送数据
    send(gstAtmClientCtx.uiSockConnId,(char *)vpstMsg,vuiMsgLen,0);
return;
}

/*******************************************************************************
* name          :
* description   :
* storage style :
* parameters    :
* parameter style              input/output description
* --------- ----------------- ------------ --------------------------
*
* -----------------------------------------------------------------------------
* comments      :
*******************************************************************************/
void dbs_AtmClientDepositHandle( void)
{
INT32 iAmount = 0;
UINT8 aucrecvbuffer[DBS_MAX_BUFFER_LENGTH] = {0};
DBS_CLIENT_SERVER_ACCOUNT_DEPOSIT_REQ_MSG_STRUCT   stReqMsg = {0};
DBS_SERVER_CLIENT_ACCOUNT_DEPOSIT_RSP_MSG_STRUCT *pstRspMsg = DBS_NULL;

if (DBS_MAX_ACCOUNT_NUMBER < gstAtmClientCtx.uiAccountId ||0 == gstAtmClientCtx.uiAccountId)
{
DBS_ERROR_LOGGING("wrong account id=%d!/n",gstAtmClientCtx.uiAccountId);
}

stReqMsg.uiAccountId = htonl(gstAtmClientCtx.uiAccountId);
if (0 == giForTest)
{
while (1)
{
   DBS_DEBUG_LOGGING("Input Deposit amount:");
   scanf("%d",&iAmount);
   if(0 > iAmount)
   {
    DBS_DEBUG_LOGGING("Amount cannot less than 0!/n");
    continue;
   }
   break;
}

stReqMsg.uiAmount = (UINT32)iAmount;
}
else
{
stReqMsg.uiAmount = rand()%1000+1;
}

stReqMsg.uiAmount = htonl(stReqMsg.uiAmount);
stReqMsg.uiMessageType = htonl(CLIENT_SERVER_ACCOUNT_DEPOSIT_REQ);
stReqMsg.uiAtmId = htonl(gstAtmClientCtx.uiAtmId);

DBS_DEBUG_LOGGING("Start deposit to account %d!/n",gstAtmClientCtx.uiAccountId);

dbs_AtmClientSendMsg2Server(&stReqMsg,sizeof(DBS_CLIENT_SERVER_ACCOUNT_DEPOSIT_REQ_MSG_STRUCT));

//从服务器获得数据
recv(gstAtmClientCtx.uiSockConnId,(char FAR *)aucrecvbuffer,DBS_MAX_BUFFER_LENGTH,0);

pstRspMsg = (DBS_SERVER_CLIENT_ACCOUNT_DEPOSIT_RSP_MSG_STRUCT *)aucrecvbuffer;

if (SERVER_CLIENT_ACCOUNT_DEPOSIT_RSP != ntohl(pstRspMsg->uiMessageType) )
{
DBS_ERROR_LOGGING("Receive unknown message,message type = %d/n",ntohl(pstRspMsg->uiMessageType));
return;
}

if (DBS_SUCCESS == ntohl(pstRspMsg->iResult)&&pstRspMsg->uiAccountId == stReqMsg.uiAccountId)
{
DBS_DEBUG_LOGGING("Successfully deposit $%d to account %d!/n/n",ntohl(stReqMsg.uiAmount),ntohl(pstRspMsg->uiAccountId));
}
else
{
DBS_DEBUG_LOGGING("Fail to deposit $%d to account %d!/n/n",ntohl(stReqMsg.uiAmount),ntohl(pstRspMsg->uiAccountId));
}

return;
}

/*******************************************************************************
* name          :
* description   :
* storage style :
* parameters    :
* parameter style              input/output description
* --------- ----------------- ------------ --------------------------
*
* -----------------------------------------------------------------------------
* comments      :
*******************************************************************************/
void dbs_AtmClientWithdrawHandle(void)
{
INT32 iAmount = 0;
UINT8 aucrecvbuffer[DBS_MAX_BUFFER_LENGTH] = {0};
DBS_CLIENT_SERVER_ACCOUNT_WITHDRAW_REQ_MSG_STRUCT stReqMsg = {0};
DBS_SERVER_CLIENT_ACCOUNT_WITHDRAW_RSP_MSG_STRUCT *pstRspMsg = DBS_NULL;

if (DBS_MAX_ACCOUNT_NUMBER < gstAtmClientCtx.uiAccountId ||0 == gstAtmClientCtx.uiAccountId)
{
DBS_ERROR_LOGGING("wrong account id=%d!/n",stReqMsg.uiAccountId);
}

stReqMsg.uiMessageType = htonl(CLIENT_SERVER_ACCOUNT_WITHDRAW_REQ);
stReqMsg.uiAtmId = htonl(gstAtmClientCtx.uiAtmId);
    stReqMsg.uiAccountId = htonl(gstAtmClientCtx.uiAccountId);
if (0 == giForTest)
{
while(1)
{
   DBS_DEBUG_LOGGING("Input withdraw amount:");
   scanf("%d",&iAmount);
   if(0 > iAmount)
   {
    DBS_DEBUG_LOGGING("Amount cannot less than 0!/n");
    continue;
   }
   break;
}
stReqMsg.uiAmount = (UINT32)iAmount;
}
else
{
stReqMsg.uiAmount = rand()%1000+1;
}

stReqMsg.uiAmount = htonl(stReqMsg.uiAmount);

DBS_DEBUG_LOGGING("Start withdraw from account %d!/n",gstAtmClientCtx.uiAccountId);

dbs_AtmClientSendMsg2Server(&stReqMsg,sizeof(DBS_CLIENT_SERVER_ACCOUNT_WITHDRAW_REQ_MSG_STRUCT));

//从服务器获得数据
recv(gstAtmClientCtx.uiSockConnId,(char FAR *)aucrecvbuffer,DBS_MAX_BUFFER_LENGTH,0);

pstRspMsg = (DBS_SERVER_CLIENT_ACCOUNT_WITHDRAW_RSP_MSG_STRUCT *)aucrecvbuffer;

if (SERVER_CLIENT_ACCOUNT_WITHDRAW_RSP != ntohl(pstRspMsg->uiMessageType))
{
DBS_ERROR_LOGGING("Receive unknown message,message type = %d/n",pstRspMsg->uiMessageType);
return;
}

if (DBS_SUCCESS == ntohl(pstRspMsg->iResult) && pstRspMsg->uiAccountId == stReqMsg.uiAccountId)
{
DBS_DEBUG_LOGGING("Successfully withdraw $%d from account %d!/n/n",ntohl(stReqMsg.uiAmount),ntohl(pstRspMsg->uiAccountId));
}
else
{
DBS_DEBUG_LOGGING("Fail to withdraw $%d from account %d!/n/n",ntohl(stReqMsg.uiAmount),ntohl(pstRspMsg->uiAccountId));
}

return;
}

/*******************************************************************************
* name          :
* description   :
* storage style :
* parameters    :
* parameter style              input/output description
* --------- ----------------- ------------ --------------------------
*
* -----------------------------------------------------------------------------
* comments      :
*******************************************************************************/
void dbs_AtmClientInquiryHandle(void)
{
UINT8 aucrecvbuffer[DBS_MAX_BUFFER_LENGTH] = {0};
DBS_CLIENT_SERVER_ACCOUNT_INQUIRY_REQ_MSG_STRUCT stReqMsg = {0};
DBS_SERVER_CLIENT_ACCOUNT_INQUIRY_RSP_MSG_STRUCT *pstRspMsg = DBS_NULL;


if (DBS_MAX_ACCOUNT_NUMBER < gstAtmClientCtx.uiAccountId ||0 == gstAtmClientCtx.uiAccountId)
{
DBS_ERROR_LOGGING("Receive wrong account id=%d!/n",gstAtmClientCtx.uiAccountId);
}

DBS_DEBUG_LOGGING("Start inquiry balance of account %d!/n",gstAtmClientCtx.uiAccountId);

stReqMsg.uiAccountId = htonl(gstAtmClientCtx.uiAccountId);
stReqMsg.uiAtmId = htonl(gstAtmClientCtx.uiAtmId);
stReqMsg.uiMessageType = htonl(CLIENT_SERVER_ACCOUNT_INQUIRY_REQ);

dbs_AtmClientSendMsg2Server(&stReqMsg,sizeof(DBS_CLIENT_SERVER_ACCOUNT_INQUIRY_REQ_MSG_STRUCT));


//从服务器获得数据
recv(gstAtmClientCtx.uiSockConnId,(char FAR *)aucrecvbuffer,DBS_MAX_BUFFER_LENGTH,0);

pstRspMsg = (DBS_SERVER_CLIENT_ACCOUNT_INQUIRY_RSP_MSG_STRUCT *)aucrecvbuffer;

if (SERVER_CLIENT_ACCOUNT_INQUIRY_RSP != ntohl(pstRspMsg->uiMessageType) )
{
DBS_ERROR_LOGGING("Receive unknown message,message type = %d/n/n",ntohl(pstRspMsg->uiMessageType));
return;
}

if (DBS_SUCCESS == ntohl(pstRspMsg->iResult) && pstRspMsg->uiAccountId == stReqMsg.uiAccountId)
{
DBS_DEBUG_LOGGING("The current balance of user %d is $%d!/n/n",ntohl(pstRspMsg->uiAccountId),ntohl(pstRspMsg->uiBalance));
}
else
{
DBS_DEBUG_LOGGING("Fail to inquiry account %d!/n/n",ntohl(pstRspMsg->uiAccountId));
}

return;
}

/*******************************************************************************
* name          :
* description   :
* storage style :
* parameters    :
* parameter style              input/output description
* --------- ----------------- ------------ --------------------------
*
* -----------------------------------------------------------------------------
* comments      :
*******************************************************************************/
void dbs_AtmClientTransactionEndHandle(void)
{
// DBS_CLIENT_SERVER_ACCOUNT_TRANSACTION_END_IND_MSG_STRUCT stReqMsg = {0};
//
// if (DBS_MAX_ACCOUNT_NUMBER < gstAtmClientCtx.uiAccountId ||0 == gstAtmClientCtx.uiAccountId)
// {
//   DBS_ERROR_LOGGING("wrong account id=%d!/n",gstAtmClientCtx.uiAccountId);
// }
//
// stReqMsg.uiMessageType = htonl(CLIENT_SERVER_ACCOUNT_TRANSACTION_END_IND);
// stReqMsg.uiAtmId = htonl(gstAtmClientCtx.uiAtmId);
// stReqMsg.uiAccountId = htonl(gstAtmClientCtx.uiAccountId);
// dbs_AtmClientSendMsg2Server(&stReqMsg,sizeof(DBS_CLIENT_SERVER_ACCOUNT_TRANSACTION_END_IND_MSG_STRUCT));

//TBD
return;
}

/*******************************************************************************
* name          :
* description   :
* storage style :
* parameters    :
* parameter style              input/output description
* --------- ----------------- ------------ --------------------------
*
* -----------------------------------------------------------------------------
* comments      :
*******************************************************************************/
void dbs_ATM_client(void)
{
UINT8    aucInput[128] = {0};
UINT16 usServerPortId = 10742;
INT32    iSockId = 0;
DBS_BOOL bTransactionEnd = DBS_FALSE;
struct sockaddr_in stHostAddr = {0};
struct sockaddr_in stServAddr = {0};
DBS_TRANSACTION_TYPE_ENUM enTransactionType;
DBS_RET_CODE iReturn = DBS_FAIL;

gstAtmClientCtx.uiAtmId = time(NULL) & 0xFFFF;

DBS_DEBUG_LOGGING("=============================================================================/n");
DBS_DEBUG_LOGGING("===============================ATM Client %d=================================/n",gstAtmClientCtx.uiAtmId);
DBS_DEBUG_LOGGING("=============================================================================/n");


/************************************************************************/
/*     InitSocket                                                       */
/************************************************************************/
DBS_DEBUG_LOGGING("Please input server Ip:");
scanf("%d.%d.%d.%d",&stServAddr.sin_addr.S_un.S_un_b.s_b1,&stServAddr.sin_addr.S_un.S_un_b.s_b2,&stServAddr.sin_addr.S_un.S_un_b.s_b3,&stServAddr.sin_addr.S_un.S_un_b.s_b4 );
//DBS_DEBUG_LOGGING("Please input server Port:");
//scanf("%d",&usServerPortId);

stServAddr.sin_family = AF_INET;
stServAddr.sin_port = htons(usServerPortId);

while(1)
{
DBS_DEBUG_LOGGING("===============================================================/n");
DBS_DEBUG_LOGGING("                 Ready for Transaction./n");
DBS_DEBUG_LOGGING("===============================================================/n");

getchar();

bTransactionEnd = DBS_FALSE;

DBS_DEBUG_LOGGING("Please Input Account:");
scanf("%d",&gstAtmClientCtx.uiAccountId);

while(1)
{
   if (0 == giForTest)
   {
    DBS_DEBUG_LOGGING("===============================================================/n");
    DBS_DEBUG_LOGGING("Please select transaction type./n1:Inquiry 2:Withdraw 3:Deposit test:for test 其它:退出 /n");
    DBS_DEBUG_LOGGING("===============================================================/n");
    scanf("%s",aucInput);
    if ('/n' == aucInput[0] || '/r' == aucInput[0])
    {
     continue;
    }
    enTransactionType = (DBS_TRANSACTION_TYPE_ENUM)atoi((char *)aucInput);

    if (0 == strcmp("test",aucInput)||0 == strcmp("TEST",aucInput))
    {
     giForTest = 1;
     enTransactionType = rand()%3+1;
    }
   }
   else
   {
    Sleep(200);
    enTransactionType = rand()%3+1;
   }


   iReturn = Dbs_InitSocket(0,&iSockId,&stHostAddr);
   if(DBS_SUCCESS != iReturn)
   {
    DBS_ERROR_LOGGING("dbs_ATM_client: Dbs_InitSocket() fail!/n");
    return;
   }
  
   //DBS_DEBUG_LOGGING("Socket init ok~~/n");  
  
   //连接服务器
   iReturn = connect(iSockId,(const struct sockaddr FAR*)&stServAddr,sizeof(const struct sockaddr FAR));
   if (SOCKET_ERROR == iReturn)
   {
    DBS_ERROR_LOGGING("WSAGetLastError = %d/n",WSAGetLastError());
    WSACleanup();
    continue;
    return ;
   }
   gstAtmClientCtx.uiSockConnId = iSockId;

   switch(enTransactionType)
   {
   case TRANSACTION_TYPE_INQUIRY:
    dbs_AtmClientInquiryHandle();
    break;
   case TRANSACTION_TYPE_WITHDRAW:
    dbs_AtmClientWithdrawHandle();
    break;
   case TRANSACTION_TYPE_DEPOSIT:
    dbs_AtmClientDepositHandle();
    break;
   default:
    bTransactionEnd = DBS_TRUE;
    dbs_AtmClientTransactionEndHandle();
    gstAtmClientCtx.uiAccountId = 0;
    DBS_DEBUG_LOGGING("Transaction End,THANK YOU./n");
    break;
   }

   //释放Winsock资源
   closesocket(iSockId);
   WSACleanup();
   if(DBS_TRUE == bTransactionEnd )
   {
    break;
   }  
}
}

//释放Winsock资源
WSACleanup();
return;
}


/************************************END OF FILE********************************/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值