Error: C-interpreter run time error: Action.c (119)
请教各位大侠为什么close_socket出错呢。。。。HELP下,谢谢了。:handshake :Q#include "lrs.h"
Action()
{
char inputBuf;
int sendLen,rc;
char *RTNCOD;
char *RTNMSG;
char * revBuff;
char bufftmp;
int len;
sprintf(inputBuf, "%s", lr_eval_string(
"82 "
"00TTY| |90|210001|90010009|50703|{account}|1||1|G|{TransType}|0|1|{price}|{amount}|"
));
sendLen=strlen(inputBuf);
lr_log_message("len=%d", sendLen);
lr_log_message("inputBuf=%s",inputBuf);
lrs_set_send_timeout(120, 0);
lrs_set_recv_timeout(120, 0);
lr_continue_on_error(1);
// lr_start_transaction("delay transaction");
rc = lrs_create_socket("socket0", "TCP", "RemoteHost={IP_Addr}:{port}",LrsLastArg);
if (rc!=0){
lr_fail_trans_with_error("An error occurred while create socket, Error Code: %d", rc);
lr_end_transaction("client_position_query",LR_FAIL);
lr_exit(LR_EXIT_ITERATION_AND_CONTINUE,LR_FAIL);
}
lrs_set_send_buffer("socket0",inputBuf,strlen(inputBuf));
rc = lrs_send("socket0", "buf0", LrsLastArg);
if (rc!=0){
lr_fail_trans_with_error("An error occurred while sending to the socket, Error Code: %d", rc);
lrs_close_socket("socket0");
lr_end_transaction("delay transaction",LR_FAIL);
lr_exit(LR_EXIT_ITERATION_AND_CONTINUE,LR_FAIL);}
lrs_set_recv_timeout(40, 0);
rc = lrs_receive("socket0", "buf1", LrsLastArg);
lr_message(" rc:%d\n", rc);
if (rc != 0 && rc != 9101)
{
lr_fail_trans_with_error("An error occurred while receiving from the socket, Error Code: %d", rc);
lrs_close_socket("socket0");
lr_end_transaction("delay transaction",LR_FAIL);
lr_exit(LR_EXIT_ITERATION_AND_CONTINUE,LR_FAIL);
}
else
{
//no data
if (lrs_get_last_received_buffer_size("socket0") < 1)
{
lr_fail_trans_with_error("No data received on socket0");
lrs_close_socket("socket0");
lr_end_transaction("delay transaction",LR_FAIL);
lr_exit(LR_EXIT_ITERATION_AND_CONTINUE,LR_FAIL);
}
//取得返回码
RTNCOD = lrs_get_received_buffer("socket0", 61, 7, NULL);
if(strcmp(RTNCOD, "AAAAAAA") !=0)
{
lr_fail_trans_with_error("错误码, RTNCOD: %s\n",RTNCOD);
lrs_close_socket("socket0");
lr_end_transaction("delay transaction",LR_FAIL);
lr_exit(LR_EXIT_ITERATION_AND_CONTINUE,LR_FAIL);
}
else
{
lr_output_message( "RECEIVE<======>%s\n","交易成功");
}
}
rc = lrs_close_socket("socket0");
if (rc==0)
{
lr_end_transaction("delay transaction", LR_PASS);
}
else
{
lr_fail_trans_with_error("An error occurred while closing the socket, Error Code: %d", rc);
lr_end_transaction("delay transaction",LR_FAIL);
}
lr_continue_on_error(0);
return 0;
}
---------------------------------------------
rc:9101
Action.c(116): RECEIVE<======>交易成功
Action.c(119): Error: C-interpreter run time error: Action.c (119):Error -- memory violation : Exception ACCESS_VIOLATION received.
Action.c(119): Notify: CCI trace: Action.c(119): LrsCloseSocket(0x00bc06a1 "socket0")
.
Action.c(119): Notify: CCI trace: Compiled_code(0): Action()
.
vuser_end.c(6): Error: C-interpreter run time error: vuser_end.c (6):Error -- memory violation : Exception ACCESS_VIOLATION received.
vuser_end.c(6): Notify: CCI trace: vuser_end.c(6): LrsCleanup()
.
vuser_end.c(6): Notify: CCI trace: Action.c(119): vuser_end()
.
页:
[1]