|
哪位大神帮忙分析下报错原因,多谢!代码如下:
#include "lrs.h"
Action()
{
int web_set_sockets_option("SHUTDOWN_MODE","ABRUPT");
//发送报文部分
char toKmc[1500] = "\0";
char toKmc1[5] = "1234\0";
//接收报文部分
char *valBufRecv; //记录接收到的数据包
int lenBufRecv = 0; //记录接收数据包的长度
char *posRespCode;
char valRespCode[3]="\0";
memset( valRespCode, 0, 3);
strcat( toKmc, toKmc1);
lr_start_transaction("1");
ErrCode = lrs_create_socket( "socket0", "TCP", "LocalHost=0", "RemoteHost=192.168.1.1:80", LrsLastArg);
if ( ErrCode != 0 )
{
lr_error_message("Create Socket failed!");
lr_end_transaction( "1", LR_FAIL);
return 0;
}
lrs_set_send_buffer( "socket0", (char *)toKmc, strlen(toKmc) );
lrs_length_send( "socket0", "buf0", 0, LrsLastArg);
lrs_set_recv_timeout( 10, 0);
lrs_set_recv_timeout2( 0.01, 0);
lrs_receive( "socket0", "buf1", LrsLastArg);
lrs_get_last_received_buffer( "socket0", &valBufRecv, &lenBufRecv);
if ( lenBufRecv == 0 )
{
lr_error_message( "No Received Data!" );
ErrCode = lrs_close_socket( "socket0");
if ( ErrCode != 0 )
{
lr_error_message("Close Socket failed!");
lr_end_transaction( "1", LR_FAIL);
return 0;
}
lr_end_transaction( "1", LR_FAIL);
}
else
{
posRespCode = (char *) strstr( valBufRecv, "<RespCode>");
strncpy( valRespCode, posRespCode+10, 2);
if ( strcmp(valRespCode,"S") == 0)
{
lr_end_transaction( "1", LR_PASS);
}
else
{
lr_error_message( "RespCode is %s", valRespCode);
lr_end_transaction( "1", LR_FAIL);
}
lenBufRecv = 0;
lrs_free_buffer( valBufRecv);
ErrCode = lrs_close_socket( "socket0");
if ( ErrCode != 0 )
{
lr_error_message("Close Socket failed!");
return 0;
}
}
web_set_sockets_option("CLOSE_KEEPALIVE_CONNECTIONS","1");
return 0;
}
报错如下:
Action.c (17): syntax error; found "SHUTDOWN_MODE" expecting `)'
Action.c (17): skipping "SHUTDOWN_MODE" `,' "ABRUPT"
e:\\boeing\317\265\315\263\274\334\271\271\323\305\273\257\\uep\327\250\317\356\262\342\312\324\\calccdserv\\\\combined_CalCCDServ.c (4): 2 errors, not writing pre_cci.ci
|
|