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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually it should be fmCreate not fmOpenWrite
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
ASKER
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(FileNam e,fmOpenRe ad);
try
IdTCPClient1.Host := 'localhost';
IdTCPClient1.Port := 12345;
IdTCPClient1.Connect;
IdTCPClient1.WriteLn(Extra ctFileName (FileName) );
IdTCPClient1.WriteStream(F ileStream, 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(BaseFil ePath + FileName,fmCreate);
try
AThread.Connection.ReadStr eam(FileSt ream);
finally
FileStream.Free;
end;
AThread.Terminate;
end;
Also, you can pass the filename with a few small changes:
procedure TForm1.Button1Click(Sender
var
FileStream : TFileStream;
FileName : String;
begin
{Client Side}
FileName := 'c:\myfile.txt';
FileStream := TFileStream.Create(FileNam
try
IdTCPClient1.Host := 'localhost';
IdTCPClient1.Port := 12345;
IdTCPClient1.Connect;
IdTCPClient1.WriteLn(Extra
IdTCPClient1.WriteStream(F
IdTCPClient1.Disconnect
Finally
FileStream.Free;
end;
end;
procedure TForm1.IdTCPServer1Execute
var
FileStream : TFileStream;
BaseFilePath : String;
begin
{Server Side}
BaseFilePath := 'c:\';
FileName := AThread.Connection.ReadLn;
FileStream := TFileStream.Create(BaseFil
try
AThread.Connection.ReadStr
finally
FileStream.Free;
end;
AThread.Terminate;
end;