X xiny Unregistered / Unconfirmed GUEST, unregistred user! 2000-02-11 #1 请问delphi中socket怎么得到数据/写数据/及判断数据到来? 最好写个简单的例子。谢谢!
L LeeChange Unregistered / Unconfirmed GUEST, unregistred user! 2000-02-11 #2 得到数据:ServerSocket1.Socket.read(readtext,....) 写数据: ServerSocket1.Socket.Send(SendText,...) 判断数据: OnGetSocket
得到数据:ServerSocket1.Socket.read(readtext,....) 写数据: ServerSocket1.Socket.Send(SendText,...) 判断数据: OnGetSocket
Z zcg Unregistered / Unconfirmed GUEST, unregistred user! 2000-02-11 #3 使用控件,很方便。读写数据有方法,数据到来有属性,至于例子,请参看Delphi提供的例子,如chat
X xiny Unregistered / Unconfirmed GUEST, unregistred user! 2000-02-11 #4 刚刚我写了一个测试程序! 为什么我不能得到http://localhost/的数据呢? CSocket1是ClientSocket控件! 请帮我看看,谢谢! procedure TForm1.FormCreate(Sender: TObject); begin CSocket1.Host:='localhost'; CSocket1.Port:=80; CSocket1.Active:=true; end; procedure TForm1.Button1Click(Sender: TObject); begin CSocket1.Socket.SendText('GET /'+#13#10); end; procedure TForm1.CSocket1Error(Sender: TObject; Socket: TCustomWinSocket; ErrorEvent: TErrorEvent; var ErrorCode: Integer); begin CSocket1.Close; end; procedure TForm1.CSocket1Read(Sender: TObject; Socket: TCustomWinSocket); begin Memo1.Lines.Add(CSocket1.Socket.ReceiveText); end;
刚刚我写了一个测试程序! 为什么我不能得到http://localhost/的数据呢? CSocket1是ClientSocket控件! 请帮我看看,谢谢! procedure TForm1.FormCreate(Sender: TObject); begin CSocket1.Host:='localhost'; CSocket1.Port:=80; CSocket1.Active:=true; end; procedure TForm1.Button1Click(Sender: TObject); begin CSocket1.Socket.SendText('GET /'+#13#10); end; procedure TForm1.CSocket1Error(Sender: TObject; Socket: TCustomWinSocket; ErrorEvent: TErrorEvent; var ErrorCode: Integer); begin CSocket1.Close; end; procedure TForm1.CSocket1Read(Sender: TObject; Socket: TCustomWinSocket); begin Memo1.Lines.Add(CSocket1.Socket.ReceiveText); end;
C cAkk Unregistered / Unconfirmed GUEST, unregistred user! 2000-02-11 #5 改 CSocket1.Host:='localhost'; 为 CSocket1.Address:='127.0.0.1'; 试一试