|
lrs_create_socket(socket_desc, "UDP",/*"RemoteHost=<IPandPort>",*/LrsLastArg);
lrs_save_param_ex(socket_desc,"user",pMsg,0,msglength,"ascii","param_login");//将消息包存为ascii格式的参数
lr_message("This msg size is:%d",msglength);
lr_message("The content of param1 is %s",lr_eval_string("<param_login>"));
//pSendMsgBuf = lr_eval_string("<param_login>");//得到消息包参数指针,这样会出错的
sprintf(pMsgbuf,"%s",lr_eval_string("<param_login>"));//copy要发送的ascii消息包内容
lr_message("The content of param1 is %s",pMsgbuf);
//lr_think_time(5);
lr_start_transaction("UserLogin_Send_Trans");
//使用下面的方式进行发送,当用户ID太大时,比如为:200000,就会send出错,还是直接对buf0进行参数化保险些
//如果长度有变,可以对data.ws文件的长度值进行修改,文件操作,或者可以尝试直接对文件长度值进行参数设置
//lrs_set_send_buffer (socket_desc,pMsgbuf, msglength);//设置要在socket_desc上发送的Buff为pSendMsgBuf
//lr_rendezvous("SendMsgRendezvous");
IsSendOK = lrs_send(socket_desc, "buf0", "TargetSocket=<IPandPort>", LrsLastArg);//还是直接对buf0进行参数化保险些
lr_end_transaction("UserLogin_Send_Trans", LR_AUTO);
lr_message("IP is %s",lr_eval_string("<IPandPort>"));
//lr_think_time(1);
if (IsSendOK!=0) {
lr_error_message("Send Data is Error %d",IsSendOK);
lrs_close_socket(socket_desc);
msglength = 0;
pRecvMsg = NULL;
pMsgbuf = NULL;
pSendMsgBuf = NULL;
pError_Recv_Data = NULL;
return 0;
}
[ 本帖最后由 zengyixun 于 2008-12-11 13:57 编辑 ] |
|