Z
zhouhuilun
Unregistered / Unconfirmed
GUEST, unregistred user!
我的连接部分代码如下:
var
Date,timestamp:string;
size:integer;
str:array[0..8] of char;
begin
fillchar(str,sizeof(str),0);
timer1.Enabled:=false;
memo2.Lines.Add('*************向服务端发送连接请求*************');
DateTimeToString(date,'zzzz',now);
fillchar(SHead,sizeof(SHead),0);
fillchar(SConnect,sizeof(SConnect),0);
size:=sizeof(SHead)+sizeof(SConnect);
SHead.Total_length:=htonl(size);
SHead.Command_ID:=htonl(CMPP_CONNECT);
SHead.Sequence_ID:=htonl(strtoint(date));
strpcopy(SConnect.Source_Addr,edit6.Text);
datetimetostring(timestamp,'mmddhhmmss',now);
strpcopy(SConnect.AuthenticatorSource,md5print(md5string(edit6.Text+str+edit8.Text+timestamp)));
SConnect.Version:=strtoint(edit7.Text);
timestamp:=format('%16d',[strtoint(timestamp)]);
SConnect.Timestamp:=htonl(strtoint(timestamp));
socket.SendBuf(SHead,sizeof(SHead));
socket.SendBuf(Sconnect,sizeof(sconnect));
为什么我一连接,服务端就主动断开了连接,是不是我的代码有问题??
我很急,各位大虾帮帮忙!!!!
var
Date,timestamp:string;
size:integer;
str:array[0..8] of char;
begin
fillchar(str,sizeof(str),0);
timer1.Enabled:=false;
memo2.Lines.Add('*************向服务端发送连接请求*************');
DateTimeToString(date,'zzzz',now);
fillchar(SHead,sizeof(SHead),0);
fillchar(SConnect,sizeof(SConnect),0);
size:=sizeof(SHead)+sizeof(SConnect);
SHead.Total_length:=htonl(size);
SHead.Command_ID:=htonl(CMPP_CONNECT);
SHead.Sequence_ID:=htonl(strtoint(date));
strpcopy(SConnect.Source_Addr,edit6.Text);
datetimetostring(timestamp,'mmddhhmmss',now);
strpcopy(SConnect.AuthenticatorSource,md5print(md5string(edit6.Text+str+edit8.Text+timestamp)));
SConnect.Version:=strtoint(edit7.Text);
timestamp:=format('%16d',[strtoint(timestamp)]);
SConnect.Timestamp:=htonl(strtoint(timestamp));
socket.SendBuf(SHead,sizeof(SHead));
socket.SendBuf(Sconnect,sizeof(sconnect));
为什么我一连接,服务端就主动断开了连接,是不是我的代码有问题??
我很急,各位大虾帮帮忙!!!!