lNet TCP/IP brak połączenia z zew. + wiele klientów

0

Witam,

kombinuję z aplikacją serwerową pod Lazarusem z lNet. Mam problem tego typu: łącząc się przez np. putty po localhost, mogę przesyłać i odbierać komunikaty między putty a moim programem, to już w przypadku połączenia z innego komputera w sieci, wszystko leży jak by serwer nie był odpalony.

unit Unit1; 

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, sqldb, FileUtil, Forms, Controls, Graphics, Dialogs,
  StdCtrls, Grids, IniPropStorage, lNetComponents, lNet;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button2: TButton;
    StringGrid1: TStringGrid;
    TCP: TLTCPComponent;
    Memo1: TMemo;
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure StringGrid1Selection(Sender: TObject; aCol, aRow: Integer);
    procedure TCPAccept(aSocket: TLSocket);
    procedure TCPConnect(aSocket: TLSocket);
    procedure TCPReceive(aSocket: TLSocket);
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

	procedure TForm1.FormCreate(Sender: TObject);
	begin
		TCP.Listen(3571);
	end;

	procedure TForm1.Button2Click(Sender: TObject);
	begin
		TCP.SendMessage('info' + #13#10);
	end;

	procedure TForm1.StringGrid1Selection(Sender: TObject; aCol, aRow: Integer);
	begin
		Button2.Enabled:=True;
	end;

	procedure TForm1.TCPAccept(aSocket: TLSocket);
	begin
	  TCP.SendMessage('Connected...' + #13#10 + '.: ');
	  Memo1.Lines.Add('Active connection from: ' + aSocket.PeerAddress + ':' + IntToStr(Integer(aSocket.LocalPort)));
	end;

	procedure TForm1.TCPConnect(aSocket: TLSocket);
	begin
	  //TCP.SendMessage('Connection OK (onConnect)' + #13#10); - ????
	end;

	procedure TForm1.TCPReceive(aSocket: TLSocket);
	var
	  msg: string;
	  S: TStrings;
	  i: Integer;
	begin
	  StringGrid1.Cells[0,1]:= aSocket.PeerAddress;
	  if TCP.GetMessage(msg) > 0 then
		begin
		  S := TStringList.Create;
		  ExtractStrings([' '], [], Pchar(msg), S);

		  for I := 0 to S.Count -1 do
			begin
			 Memo1.Lines.Add(S[i]);
			end;

		  S.Free;
		end;
	end;

end.

O czym zapomniałem?

0

kombinuję z aplikacją serwerową pod Lazarusem z lNet

Kto używa INet... o_O

O czym zapomniałem?

O przekierowaniu portów/czymś innym co dotyczy każdego socketowego połączenia...

0

O odblokowaniu portu na firewallu

1 użytkowników online, w tym zalogowanych: 0, gości: 1