目前只能实现,server端也就是接收端需要有独立的IP。
我想实现象QQ那样。比如接收方在局域网内一台机器a上,在7777端口listen,通过主机b连到internet。c机也是通过internet想连a机,假设c机已经知道目标ip,是b机的,也就网关的,那么怎么映射到A机呢?
我不是用udp连接的。使用clientsocket,serversocket实现的。如果需要建立一个独立IP的服务器,象QQ服务器一样,存放A,C机连接到服务器的ip和端口。我想a机出去,服务器应该是存放的是b机的端口吧。但具体如何实现,请帮忙提供一下思路,能够有源码更好。
100分肯定不够的,如果有思路,我会另外发贴给分。有源码就给500。
server端.pas文件如下:
×××××××××××××××××××××××××××××××××××××
unit server;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ScktComp, StdCtrls, ComCtrls;
type
  TForm1 = class(TForm)
    ServerSocket1: TServerSocket;
    SaveDialog1: TSaveDialog;
    ProgressBar1: TProgressBar;
    Button1: TButton;
    Edit3: TEdit;
    Label3: TLabel;
    Label1: TLabel;
    StatusBar1: TStatusBar;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure ServerSocket1ClientRead(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure SaveDialog1CanClose(Sender: TObject; var CanClose: Boolean);
    procedure Button1Click(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure Button2Click(Sender: TObject);
    procedure ServerSocket1ClientError(Sender: TObject;
      Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
      var ErrorCode: Integer);  private
    { Private declarations }
  public  end;
  toptions = (load, listen, api);
  tinfo = (fname, size, path);var
  Form1: TForm1;
  opt, loadopt: toptions;
  info: tinfo;
//   m1:tmemorystream;
  RecevFstream: TFileStream;
  filesize: longint; //文件长度;
  fullfilesize: longint;
  filename, filepath: string;
  suspend: boolean = false;
const
maxsize = 2048;
implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
begin
//m1:=tmemorystream.Create; //创建流对象
{ serversocket1.port:=7777;
 serversocket1.Open;
 opt:=listen;  }
  Button1Click(nil);
end;

解决方案 »

  1.   

    procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
      Socket: TCustomWinSocket);
    var tem: string;
      len: longint; //包长度
      buffer: array[0..10000] of byte; //设置接收缓冲区
      buf: array[1..maxsize] of byte; //以2k大小为一个传送单位,大了可能出错
    begin
      if suspend then
      begin
        Socket.SendText('suspend');
        try
          RecevFstream.Free;
          RecevFstream := nil;
        except
        end;    opt := listen; //开始重置状态
        loadopt := listen;
        info := size;
        ProgressBar1.Position := 0;
        StatusBar1.Panels[1].Text := '空闲';
        suspend := false;
        exit;
      end;
    {  tem := Socket.ReceiveText;
      if tem = 'suspend' then
      begin
        Messagedlg('对方中止传送', mtinformation, [mbok], 0);
        RecevFstream.Free;
        RecevFstream := nil;
        opt := listen; //开始重置状态
        loadopt := listen;
        info := size;
        tem := '';
        ProgressBar2.Position := 0;
        StatusBar2.Panels[1].Text := '空闲';
        exit;
      end;
    }
      case opt of //主循环
        listen: //监听状态 (1级)
          begin
           tem := Socket.ReceiveText;
            if tem = 'send' then
            begin
              if messagedlg('有新文件传来,要接收吗?', mtconfirmation, [mbyes, mbno], 0) = mryes then
              begin
                socket.SendText('getsize'); opt := load; loadopt := listen; info := size;
              end
              else begin
                socket.SendText('refuse');
                exit;
              end;
            end; //改变状态
          end;
        load: //接收流 (1级)
          begin
            case loadopt of
              listen: //准备接收(2级)
                begin
                 tem := Socket.ReceiveText;
                  case info of //准备接收的数据 (3级)
                    size: begin
                        info := fname; //改变状态
                        filesize := strtoint(tem);
                        fullfilesize := filesize;
                        socket.SendText('getname');
                        StatusBar1.Panels[1].Text := '获取文件名';
                      end;
    {           path: begin
                        info:=fname;    //改变状态
                        filepath:=tem;
                        socket.SendText('getname');
                     end;}
                    fname: begin
                        info := size; loadopt := load; //改变状态
                        filename := tem;
                        SaveDialog1.FileName := filename;
                        socket.SendText('getdata');
                        StatusBar1.Panels[1].Text := '数据传送开始';
                      end;
                  end;
                end;
              load: //接收中(2级)
                begin
    {        len:=socket.ReceiveLength; //读出包长度
            socket.ReceiveBuf(buffer,len); //接收数据包并读入缓冲区内
            m1.write(buffer,len);  //追加入 流M 中
            if m1.Size>=filesize then   //完成了流M 的传送
               begin
                  m1.Position:=0;
                   m1.SaveToFile(filename);
                  //copyfile(pchar(filename),pchar(filepath+filename),true);
                  opt:=listen;    //开始重置状态
                  loadopt:=listen;
                  info:=size;
                  tem:='';
                  Messagedlg('传送结束', mtinformation, [mbok], 0);
                  socket.SendText('loadfileok');
               end;    }              if RecevFstream = nil then
                  begin
    //            tem:=socket.ReceiveText;
    //            len:=socket.ReceiveLength;
                    SaveDialog1.FileName := FileName;
                    if not SaveDialog1.Execute then
                    begin
                      opt := listen; //开始重置状态
                      loadopt := listen;
                      info := size;
                      tem := '';
                      StatusBar1.Panels[1].Text := '空闲';
                      socket.SendText('refuse');
                      exit;
                    end;
                    try
                      FileName := SaveDialog1.FileName;
                      RecevFstream := TFileStream.Create(FileName, fmCreate);
                    except
                      Messagedlg('文件写入失败', mtinformation, [mbok], 0);
                      exit;
                    end;
                    ProgressBar1.Max := filesize;
                    ProgressBar1.Position := 0;
    //            Socket.SendText('getdata');
                  end;
                  try
                    if maxsize < filesize then
                    begin
                      len:=socket.ReceiveLength; //读出包长度
                      if len < 10 then
                      begin
                        Messagedlg('对方中止传送', mtinformation, [mbok], 0);
                        RecevFstream.Free;
                        RecevFstream := nil;
                        opt := listen; //开始重置状态
                        loadopt := listen;
                        info := size;
                        tem := '';
                        ProgressBar1.Position := 0;
                        StatusBar1.Panels[1].Text := '空闲';
                        exit;
                      end;
                      Socket.ReceiveBuf(buf, maxsize);
                      RecevFstream.WriteBuffer(buf, maxsize);
                      filesize := filesize - maxsize;
                      socket.SendText('getdata');
                      ProgressBar1.StepBy(maxsize);
                      StatusBar1.Panels[1].Text := '数据传送中...' + '文件总长度' + inttostr(fullfilesize) + '字节,剩余' + inttostr(filesize) + '字节';
                    end
                    else
                    begin
                      len:=socket.ReceiveLength; //读出包长度
                      if len < 10 then
                      begin
                        Messagedlg('对方中止传送', mtinformation, [mbok], 0);
                        RecevFstream.Free;
                        RecevFstream := nil;
                        opt := listen; //开始重置状态
                        loadopt := listen;
                        info := size;
                        tem := '';
                        ProgressBar1.Position := 0;
                        StatusBar1.Panels[1].Text := '空闲';
                        exit;
                      end;
                      socket.ReceiveBuf(buf, filesize);
                      RecevFstream.WriteBuffer(Buf, filesize);
                      RecevFstream.Free;
                      RecevFstream := nil;
                      ProgressBar1.Position := ProgressBar1.Max;
                      StatusBar1.Panels[1].Text := '数据传送完毕';
                      Messagedlg('传送结束', mtinformation, [mbok], 0);
                      socket.SendText('loadfileok');
                      opt := listen; //开始重置状态
                      loadopt := listen;
                      info := size;
                      tem := '';
                      ProgressBar1.Position := 0;
                      StatusBar1.Panels[1].Text := '空闲';
                    end;
                  except
                    Messagedlg('数据包写入失败', mtinformation, [mbok], 0);
                    RecevFstream.Free;
                    RecevFstream := nil;
                    exit;
                  end;
                end;
            end; // of case  loadopt
          end; //接收流over    api: //执行各种命令  (1级)
          begin
          end;
      end; //of case optend;
      

  2.   

    procedure TForm1.SaveDialog1CanClose(Sender: TObject;
      var CanClose: Boolean);
    begin
      if FileExists(SaveDialog1.FileName) then
      begin
        if Messagedlg('目标文件已存在,覆盖吗?', mtconfirmation, [mbyes, mbno], 0) = mryes then
          DeleteFile(SaveDialog1.FileName)
        else
          CanClose := false;
      end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      if serversocket1.Active and (RecevFstream <> nil) then
      begin
        Messagedlg('上次传送还未结束', mtinformation, [mbok], 0);
        exit;
      end;
      try
        serversocket1.Close;
        serversocket1.port := strtoint(edit3.text);
        serversocket1.Open;
        opt := listen;
        StatusBar1.Panels[0].Text := '已上线';
        StatusBar1.Panels[1].Text := '空闲';
      except
        StatusBar1.Panels[0].Text := '离线';
        StatusBar1.Panels[1].Text := '';
      end;
    end;procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
      if serversocket1.Active and (RecevFstream <> nil) then
      begin
        if messagedlg('文件传送还未结束,确认退出吗?', mtconfirmation, [mbyes, mbno], 0) = mrno then
        begin
          CanClose := false;
          abort;
        end;
        suspend := true;  end;
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
      if serversocket1.Active and (RecevFstream <> nil) then
      begin
        if messagedlg('文件传送还未结束,确认中止吗?', mtconfirmation, [mbyes, mbno], 0) = mryes then
        begin
          suspend := true;
    {                      ServerSocket1.Close;
        try
                 RecevFstream.Free;
                  RecevFstream:=nil;
        except
        end;              opt:=listen;    //开始重置状态
                  loadopt:=listen;
                  info:=size;
                  ProgressBar1.Position:=0;
                  StatusBar1.Panels[1].Text:='空闲';
              ServerSocket1.Open;  }
        end;
      end;
    end;procedure TForm1.ServerSocket1ClientError(Sender: TObject;
      Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
      var ErrorCode: Integer);
    begin
      StatusBar1.Panels[0].Text := '已上线';
      StatusBar1.Panels[1].Text := '传送失败';
      errorcode := 0;
      opt := listen; //开始重置状态
      loadopt := listen;
      info := size;
      ProgressBar1.Position := 0;
      if (RecevFstream <> nil) then
      begin
        RecevFstream.Free;
        RecevFstream := nil;  end;
    end;end.
      

  3.   


    ××××××××××××××××××××××××××××××
    dfm文件如下:
    object Form1: TForm1
      Left = 289
      Top = 233
      Width = 430
      Height = 125
      Caption = 'server'
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      OldCreateOrder = False
      Position = poDesktopCenter
      OnCloseQuery = FormCloseQuery
      OnCreate = FormCreate
      PixelsPerInch = 96
      TextHeight = 13
      object Label3: TLabel
        Left = 16
        Top = 16
        Width = 18
        Height = 13
        Caption = 'port'
      end
      object Label1: TLabel
        Left = 0
        Top = 40
        Width = 48
        Height = 13
        Caption = '传送进度'
      end
      object ProgressBar1: TProgressBar
        Left = 0
        Top = 56
        Width = 417
        Height = 16
        Min = 0
        Max = 100
        TabOrder = 0
      end
      object Button1: TButton
        Left = 176
        Top = 8
        Width = 75
        Height = 25
        Caption = 'listen'
        TabOrder = 1
        OnClick = Button1Click
      end
      object Edit3: TEdit
        Left = 40
        Top = 11
        Width = 121
        Height = 21
        TabOrder = 2
        Text = '7777'
      end
      object StatusBar1: TStatusBar
        Left = 0
        Top = 79
        Width = 422
        Height = 19
        Panels = <
          item
            Width = 50
          end
          item
            Width = 300
          end>
        SimplePanel = False
      end
      object Button2: TButton
        Left = 256
        Top = 8
        Width = 73
        Height = 25
        Caption = 'stop'
        TabOrder = 4
        OnClick = Button2Click
      end
      object ServerSocket1: TServerSocket
        Active = False
        Port = 0
        ServerType = stNonBlocking
        OnClientRead = ServerSocket1ClientRead
        OnClientError = ServerSocket1ClientError
        Left = 152
        Top = 24
      end
      object SaveDialog1: TSaveDialog
        OnCanClose = SaveDialog1CanClose
        Left = 216
        Top = 24
      end
    end
      

  4.   

    client端.pas文件如下:
    ×××××××××××××××××××××××××××××××××××××unit client;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls, ScktComp, ExtCtrls, ComCtrls;type
      TForm1 = class(TForm)
        ClientSocket1: TClientSocket;
        Button1: TButton;
        Button2: TButton;
        OpenDialog1: TOpenDialog;
        Edit2: TEdit;
        Label2: TLabel;
        Edit3: TEdit;
        Label3: TLabel;
        ProgressBar1: TProgressBar;
        Label1: TLabel;
        StatusBar1: TStatusBar;
        Button3: TButton;
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
        procedure ClientSocket1Connect(Sender: TObject;
          Socket: TCustomWinSocket);
        procedure ClientSocket1Error(Sender: TObject; Socket: TCustomWinSocket;
          ErrorEvent: TErrorEvent; var ErrorCode: Integer);
        procedure Button2Click(Sender: TObject);
        procedure ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
        //取文件名,但系统自带函数了
        function getfilename(fullpath: string): string;
        procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
        procedure Button3Click(Sender: TObject);
        procedure ClientSocket1Disconnect(Sender: TObject;
          Socket: TCustomWinSocket);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      m1: TFileStream;
      filesize: longint;
      fullfilesize: longint;
      filepath, filename, shortname: string;
      suspend: Boolean = false;
    const
    maxsize = 2048;
    implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
    begin
      StatusBar1.Panels[0].Text := '未建立连接';
      StatusBar1.Panels[1].Text := '空闲';
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      if clientsocket1.Active and (m1 <> nil) then
      begin
        Messagedlg('上次传送还未结束', mtinformation, [mbok], 0);
        exit;
      end;
      try
        clientsocket1.Close;
        clientsocket1.Port := strtoint(edit3.text);
        ClientSocket1.Address := edit2.text;
    //clientsocket1.Host:=edit2.text;
        clientsocket1.Open;
      except
        StatusBar1.Panels[0].Text := '不能建立连接';
        StatusBar1.Panels[1].Text := '空闲';
      end;
    end;procedure TForm1.ClientSocket1Connect(Sender: TObject;
      Socket: TCustomWinSocket);
    begin
      StatusBar1.Panels[0].Text := '已建立连接';
      StatusBar1.Panels[1].Text := '空闲';
    end;procedure TForm1.ClientSocket1Error(Sender: TObject;
      Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
      var ErrorCode: Integer);
    begin
      StatusBar1.Panels[0].Text := '连接失败';
      StatusBar1.Panels[1].Text := '空闲';
      ProgressBar1.Position := 0;
      ErrorCode := 0;
      if (m1 <> nil) then
      begin
        m1.Free;
        m1 := nil;  end;
    end;procedure TForm1.Button2Click(Sender: TObject);
    var tem: string;
    begin
      if not clientsocket1.Active then
      begin
        Messagedlg('请先连接目标机器', mtinformation, [mbok], 0);
        exit;
      end;
      if m1 <> nil then
      begin
        Messagedlg('上次传送还未结束', mtinformation, [mbok], 0);
        exit;
      end;
      ClientSocket1.close;
      clientsocket1.open;
      if opendialog1.Execute then
      begin
        try
    //        filename:=getfilename(OpenDialog1.FileName);
          filename := ExtractFileName(OpenDialog1.FileName);
          m1 := TFileStream.Create(OpenDialog1.FileName, fmOpenRead); //create 流对象 m
    //       m1.Position:=0;
    //        m1.LoadFromFile(filename);
          filesize := m1.Size;
          fullfilesize := m1.Size;
          ProgressBar1.Max := filesize;
          ProgressBar1.Position := 0;
          StatusBar1.Panels[1].text := '文件总长度' + inttostr(fullfilesize) + '字节,已传送0字节';
        except
          Messagedlg('文件读入失败', mtinformation, [mbok], 0);
          exit;
        end;
      end;
      clientsocket1.Socket.SendText('send');
    end;
    procedure TForm1.ClientSocket1Read(Sender: TObject;
      Socket: TCustomWinSocket);
    var
      tem: string;
      buf: array[1..maxsize] of byte; //以2k大小为一个传送单位,大了可能出错
    begin
      if suspend then
      begin
        ClientSocket1.Socket.SendText('suspend');
        StatusBar1.Panels[1].Text := '空闲';
        try
          m1.Free;
          m1 := nil;
        except
        end;
        ProgressBar1.Position := 0;
        suspend := false;
        exit;
      end;
      tem := clientsocket1.Socket.ReceiveText;
    //label1.Caption:=tem;  if tem = 'getsize' then
      begin
        clientsocket1.Socket.SendText(inttostr(filesize));
        StatusBar1.Panels[1].Text := '传送文件大小';
      end;
    {if tem='getpath' then clientsocket1.Socket.SendText('d');    }
      if tem = 'getname' then
      begin
        clientsocket1.Socket.SendText(filename);
        StatusBar1.Panels[1].Text := '传送文件名';
      end;
      if tem = 'refuse' then
      begin
        Messagedlg('对方拒绝接收', mtinformation, [mbok], 0);
        try
          m1.Free;
          m1 := nil;
        except
        end;
        ProgressBar1.Position := 0;
        StatusBar1.Panels[1].Text := '空闲';
      end;
      if tem = 'getdata' then
      begin
    {    m:=tmemorystream.Create;//create 流对象 m
          m.Position:=0;
          m.LoadFromFile(filename);
         m.Position:=0;
        } try
          if maxsize < filesize then
          begin
            m1.ReadBuffer(buf, maxsize);
            Socket.SendBuf(buf, maxsize);
            filesize := filesize - maxsize;
            ProgressBar1.StepBy(maxsize);
            StatusBar1.Panels[1].Text := '文件传送中...' + '文件总长度' + inttostr(fullfilesize) + '字节,剩余' + inttostr(filesize) + '字节';
          end
          else begin
            m1.ReadBuffer(buf, filesize);
            Socket.SendBuf(buf, filesize);
            ProgressBar1.Position := ProgressBar1.Max;
            StatusBar1.Panels[1].Text := '文件传送完毕';
            m1.Free;
            m1 := nil;
          end;
        except
          Messagedlg('数据包传送失败', mtinformation, [mbok], 0);
          exit;
        end;
      end;
      if tem = 'loadfileok' then
      begin
        Messagedlg('传送结束', mtinformation, [mbok], 0);
        StatusBar1.Panels[1].Text := '空闲';
        ProgressBar1.Position := 0;
      end;
      if tem = 'suspend' then
      begin
        Messagedlg('对方中止传送', mtinformation, [mbok], 0);
        StatusBar1.Panels[1].Text := '空闲';
        m1.Free;
        m1 := nil;
        ProgressBar1.Position := 0;
      end;
    end;function TForm1.getfilename(fullpath: string): string;
    var
      p: integer;
    begin
      p := Pos('\', fullpath);
      while (p > 0) do
      begin
        Delete(fullpath, 1, p);
        p := Pos('\', fullpath);
      end;
      Result := fullpath;
    end;procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
      if ClientSocket1.Active and (m1 <> nil) then
      begin
        if messagedlg('文件传送还未结束,确认退出吗?', mtconfirmation, [mbyes, mbno], 0) = mrno then
        begin
          CanClose := false;
          abort;
        end;
        suspend := true;
      end;
    end;procedure TForm1.Button3Click(Sender: TObject);
    begin
      if ClientSocket1.Active and (m1 <> nil) then
      begin
        if messagedlg('文件传送还未结束,确认中止吗?', mtconfirmation, [mbyes, mbno], 0) = mryes then
        begin
          suspend := true;
        end;
      end;end;procedure TForm1.ClientSocket1Disconnect(Sender: TObject;
      Socket: TCustomWinSocket);
    begin
      if m1 <> nil then
      begin
        Messagedlg('与目标机器断开连接', mtinformation, [mbok], 0);
        StatusBar1.Panels[1].Text := '空闲';
        try
          m1.Free;
          m1 := nil;
        except
        end;
        ProgressBar1.Position := 0;
      end;
    end;end.
      

  5.   

    object Form1: TForm1
      Left = 253
      Top = 227
      Width = 407
      Height = 143
      Caption = 'Form1'
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      OldCreateOrder = False
      Position = poDesktopCenter
      OnCloseQuery = FormCloseQuery
      OnCreate = FormCreate
      PixelsPerInch = 96
      TextHeight = 13
      object Label2: TLabel
        Left = 40
        Top = 24
        Width = 10
        Height = 13
        Caption = 'IP'
      end
      object Label3: TLabel
        Left = 40
        Top = 48
        Width = 18
        Height = 13
        Caption = 'port'
      end
      object Label1: TLabel
        Left = 8
        Top = 64
        Width = 48
        Height = 13
        Caption = '传送进度'
      end
      object Button1: TButton
        Left = 192
        Top = 0
        Width = 75
        Height = 25
        Caption = 'connect'
        TabOrder = 0
        OnClick = Button1Click
      end
      object Button2: TButton
        Left = 192
        Top = 27
        Width = 75
        Height = 25
        Caption = 'send'
        TabOrder = 1
        OnClick = Button2Click
      end
      object Edit2: TEdit
        Left = 64
        Top = 19
        Width = 121
        Height = 21
        TabOrder = 2
        Text = '127.0.0.1'
      end
      object Edit3: TEdit
        Left = 64
        Top = 43
        Width = 121
        Height = 21
        TabOrder = 3
        Text = '7777'
      end
      object ProgressBar1: TProgressBar
        Left = 1
        Top = 80
        Width = 392
        Height = 16
        Min = 0
        Max = 100
        TabOrder = 4
      end
      object StatusBar1: TStatusBar
        Left = 0
        Top = 97
        Width = 399
        Height = 19
        Panels = <
          item
            Width = 50
          end
          item
            Width = 300
          end>
        SimplePanel = False
      end
      object Button3: TButton
        Left = 192
        Top = 54
        Width = 73
        Height = 25
        Caption = 'stop'
        TabOrder = 6
        OnClick = Button3Click
      end
      object ClientSocket1: TClientSocket
        Active = False
        ClientType = ctNonBlocking
        Port = 0
        OnConnect = ClientSocket1Connect
        OnDisconnect = ClientSocket1Disconnect
        OnRead = ClientSocket1Read
        OnError = ClientSocket1Error
        Left = 112
        Top = 64
      end
      object OpenDialog1: TOpenDialog
        Left = 160
        Top = 64
      end
    end
      

  6.   

    全部贴完了。分数多多,请大家多提宝贵意见。
    可以Mail我: [email protected]
    谢谢。
      

  7.   

    不好意思。文件打包容易,可是没地方上传,只好这样贴上来,还受帖子大小限制,分了很多帖。我DFM文件也帖了。整合一下,可以编译通过的。
    希望能够得到思路。
    我在大富翁上也发了帖,那里没有大小限制。
    http://www.delphibbs.com/delphibbs/dispq.asp?lid=1966465
      

  8.   

    大概原理我已经清楚了。大富翁那有人很详细的回了帖。很遗憾在这没找到答案。谁有一些关于DELPHI的SOCKET编程资料,或者推荐一些网站,链接。我也散分了。
      

  9.   

    这个帖子不错.
    http://expert.csdn.net/Expert/topic/1684/1684309.xml?temp=.3360102
      

  10.   

    如果知道本机(a)计算机名和“网关IP”(b),SOCKET就可以连呀。c.socket.host=a.计算机名,c.socket.address =b.IP。我曾经用邮箱做中转,就可以实现。有服务器更好。