pegasus ..hehe..好久没见了!
是这样!
我只要登陆的那一点东西!
c,c++,delphi,windows,unix的都可以,
谁能给个例子
我这儿开个头
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ScktComp;
type
TForm1 = class(TForm)
ClientSocket1: TClientSocket;
Memo1: TMemo;
Button1: TButton;
Edit1: TEdit;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
procedure Button2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
function ShowString(s: string) :string;
var
Form1: TForm1;
implementation
{$R *.DFM}
function ShowString(s: string) :string ;
var
i: integer ;
begin
Result:= '';
for i := 1 to Length(s) do Result := Result+IntToStr(ord(s))+'+' ;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientSocket1.Active:= true;
end;
procedure TForm1.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
var
sa :string ;
begin
sa := Socket.ReceiveText ;
Memo1.Lines.Append(sa);
Memo1.Lines.Append(ShowString(sa));
end;
谢谢!
procedure TForm1.Button2Click(Sender: TObject);
begin
//这里是应答
ClientSocket1.Socket.SendText(Edit1.Text);
~~~~~~肯定还要加上一些控制符!?
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ClientSocket1.Active:= false ;
end;
end.