communication port

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
multimesut
Posts: 18
Joined: Mon 28 Nov 2011 18:04
Location: Türkiye

communication port

Post by multimesut » Mon 28 Nov 2011 18:12

I want to write a chat program. The following small application is not running. can cause? IdUDPClient1>IdUDPServer1 information does not come. Thank you ..

x.x.x.x=sever ip

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
ScSSHClient1.HostName:='x.x.x.x';
ScSSHClient1.Port:=443;
ScSSHClient1.User:='test';
ScSSHClient1.Password:='test';
ScSSHClient1.Connect;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
ScSSHChannel1.SourcePort:=5001;
ScSSHChannel1.DestHost:='x.x.x.x';
ScSSHChannel1.DestPort:=1987;
ScSSHChannel1.Connect;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
IdUDPServer1.DefaultPort:=5001;
IdUDPServer1.Active:=true;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
IdUDPClient1.Host:='91.93.61.60';
IdUDPClient1.Port:=1987;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
IdUDPClient1.Send('aq');
end;

procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TStream;
  ABinding: TIdSocketHandle);
var
stream : TStringStream;
begin
  try
  stream := TStringStream.Create('');
  stream.CopyFrom( AData, AData.Size);
  Memo1.Lines.Add(ABinding.PeerIP+'-'+stream.DataString)
  finally
  stream.Free;
  end;
end;

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 29 Nov 2011 09:05

Try to change the following code:

Code: Select all

ScSSHChannel1.SourcePort:=5001; 
ScSSHChannel1.DestHost:='x.x.x.x'; 
ScSSHChannel1.DestPort:=1987; 
ScSSHChannel1.Connect; 
to the code:

Code: Select all

ScSSHChannel1.SourcePort:=1987; 
ScSSHChannel1.DestHost:='x.x.x.x'; 
ScSSHChannel1.DestPort:=5001; 
ScSSHChannel1.Connect; 

multimesut
Posts: 18
Joined: Mon 28 Nov 2011 18:04
Location: Türkiye

:(

Post by multimesut » Tue 29 Nov 2011 10:17

I'm sorry does not work. I want to do it too. goal is to make an application, such as msn. (mini chat) "1 server, many client" note:ssh server running this program in a different place.

thank you for help.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 29 Nov 2011 15:32

When performing local port forwarding, TScSSHChannel listens to the port specified in TScSSHChannel.SourcePort, receives data, encodes and transmits it to SSH server. Server decodes data and transmits it to UDP server. Therefore your UDP server must run on computer where SSH is available server or on host to which SSH server has access.

You can find detailed information about it in the "SSH-tunnel principles" topic of SecureBridge help.

multimesut
Posts: 18
Joined: Mon 28 Nov 2011 18:04
Location: Türkiye

..

Post by multimesut » Wed 30 Nov 2011 07:46

programs that have a connection between two computers. sent the attached image. I want to do like that.

Image

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 30 Nov 2011 14:22

For this purpose you can use events of the TScSSHServer component.
You can look at the example of handling these events in the SSHServerService demo.

Post Reply