Link to home
Start Free TrialLog in
Avatar of rpmcdonald
rpmcdonald

asked on

Virtual Private Network

I am writing a communication software and I want to be able to transfer data (probably text files) over a VPN. Any ideas or possible better solutions.
I am very generous with points, I'm looking for something that is more or less bug proof and secure. I have a total of 720pts avalible for this question depending on speed and value.
ASKER CERTIFIED SOLUTION
Avatar of rbohac
rbohac

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rbohac
rbohac

Actually it should be fmCreate not fmOpenWrite
Avatar of rpmcdonald

ASKER

Would both server and client need to manually activated or would the server automatically know when a transmission was sent...
IDTCPServer has an active property. This would need to be set to true before it would accept connections. After that it would automatically accept (and multithread) new connections
Sounds Great!! I wont be able to test it for a while, but thanks for the help
Sure. Followup if you have any more questions about it.

Also, you can pass the filename with a few small changes:
procedure TForm1.Button1Click(Sender: TObject);
var
  FileStream : TFileStream;
  FileName   : String;
begin
  {Client Side}
  FileName   := 'c:\myfile.txt';
  FileStream := TFileStream.Create(FileName,fmOpenRead);
  try
    IdTCPClient1.Host := 'localhost';
    IdTCPClient1.Port := 12345;
    IdTCPClient1.Connect;
    IdTCPClient1.WriteLn(ExtractFileName(FileName));
    IdTCPClient1.WriteStream(FileStream,True,True);
    IdTCPClient1.Disconnect
  Finally
    FileStream.Free;
  end;

end;

procedure TForm1.IdTCPServer1Execute(AThread: TIdPeerThread);
var
  FileStream   : TFileStream;
  BaseFilePath : String;
begin
  {Server Side}
  BaseFilePath := 'c:\';
  FileName     := AThread.Connection.ReadLn;
  FileStream   := TFileStream.Create(BaseFilePath + FileName,fmCreate);
  try
    AThread.Connection.ReadStream(FileStream);
  finally
    FileStream.Free;
  end;
  AThread.Terminate;
end;