G
guolei0451
Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下:
procedure TForm1.Button2Click(Sender: TObject);
begin
if Button2.Caption='登录' then
begin
Button2.Caption:='断开';
ClientSocket1.Address:=Edit2.Text;
ClientSocket1.Active:=False;
ClientSocket1.Active:=True;
Button1.Enabled:=True;
Edit1.Enabled:=True;
end
else
begin
Button2.Caption:='登录';
ClientSocket1.Active:=False;
Button1.Enabled:=False;
Edit1.Enabled:=False;
end;
end;
运行的时候一点button2就出错,提示信息是这样的'asynchronouyou socket error 10061'
我发现只要把ClientSocket1.Active:=False;
ClientSocket1.Active:=True;去掉就没有错误了,用分步执行的时候ClientSocket1.Address:='';取不到地址,而用ClientSocket1.Address:='192.168.1.123';的时候确有错,说类型不匹配,
把ClientSocket1.Address:=Edit2.Text;删掉提示说找不到地址,
我在ClientSocket1属性里就设定了port=2058,
ClientSocket1属性一般都怎么设置
这是怎么回事啊,请 指教,谢谢,
procedure TForm1.Button2Click(Sender: TObject);
begin
if Button2.Caption='登录' then
begin
Button2.Caption:='断开';
ClientSocket1.Address:=Edit2.Text;
ClientSocket1.Active:=False;
ClientSocket1.Active:=True;
Button1.Enabled:=True;
Edit1.Enabled:=True;
end
else
begin
Button2.Caption:='登录';
ClientSocket1.Active:=False;
Button1.Enabled:=False;
Edit1.Enabled:=False;
end;
end;
运行的时候一点button2就出错,提示信息是这样的'asynchronouyou socket error 10061'
我发现只要把ClientSocket1.Active:=False;
ClientSocket1.Active:=True;去掉就没有错误了,用分步执行的时候ClientSocket1.Address:='';取不到地址,而用ClientSocket1.Address:='192.168.1.123';的时候确有错,说类型不匹配,
把ClientSocket1.Address:=Edit2.Text;删掉提示说找不到地址,
我在ClientSocket1属性里就设定了port=2058,
ClientSocket1属性一般都怎么设置
这是怎么回事啊,请 指教,谢谢,