Autor Beitrag
Juliman
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 81



BeitragVerfasst: Mi 29.09.04 20:23 
Ich versuche erst einmal eine TCP-Verbindung aufzubauen... Aber es klappt nicht.

Vielleicht kann mir ja einer helfen.. ICh habe in der Suche gescaut, konnte aber nichts passendes finden.

Dies ist der Server:
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
unit server;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Sockets;

type
  TForm1 = class(TForm)
    server: TTcpServer;
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
server.RemotePort:='12332';
server.active:=TRUE;


server.Open;


end;

end.


und dies der Client:

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
unit client;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Sockets;

type
  TForm1 = class(TForm)
    client: TTcpClient;
    procedure FormCreate(Sender: TObject);
    procedure clientConnect(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
client.LocalPort:='12332';
client.LocalHost:='192.168.2.2';
client.Active:=TRUE;
end;

procedure TForm1.clientConnect(Sender: TObject);
begin
ShowMessage('HALLO');
end;

end.


Ich hoffe mir kann jemand helfen... Ich weiß nämlich echt nicht weiter...

Dankeschön

Julian


Zuletzt bearbeitet von Juliman am Di 05.10.04 12:27, insgesamt 2-mal bearbeitet
Larus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 431



BeitragVerfasst: So 03.10.04 10:43 
Titel: womit?
Womit Arbeitest du? Client Server sockets?
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 03.10.04 10:46 
Hi!

Ich glaube es liegt daran, dass es nicht

ausblenden Delphi-Quelltext
1:
2:
3:
client.LocalPort:='12332';  
client.LocalHost:='192.168.2.2';  
client.Active:=TRUE;


sondern

ausblenden Delphi-Quelltext
1:
2:
3:
client.Port:='12332';  
client.Host:='192.168.2.2';  
client.Active:=TRUE;


heißen muss.

Alstar
Larus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 431



BeitragVerfasst: So 03.10.04 10:51 
Titel: wenns die sockets sind
Zitat:
Hi!

Ich glaube es liegt daran, dass es nicht

Sourcecode
ausgeblendet markieren
1:
2:
3:
client.LocalPort:='12332';
client.LocalHost:='192.168.2.2';
client.Active:=TRUE;




sondern

Sourcecode
ausgeblendet markieren
1:
2:
3:
client.Port:='12332';
client.Host:='192.168.2.2';
client.Active:=TRUE;




heißen muss.

Alstar


Kommt drauf an wenn er die Client und Serversockets verwendet is das richtig wie das aber bei den Indycomponents is weiß ich net
Juliman Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 81



BeitragVerfasst: So 03.10.04 10:55 
Ich arbeite mit den Client Server sockets. Wenn ich das so mache, dann meint er undefinierter Bezeichner 'Port' Ich glaube das stimmt so schon... ABer was kann noch falsch sein?
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 03.10.04 10:55 
Bei Indys ist es genauso

Alstar
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 03.10.04 10:57 
Zitat:

Wenn ich das so mache, dann meint er undefinierter Bezeichner 'Port'


ClientSocket und ServerSocket besitzen beide die Eigenschaft "Port". Das kann also nicht sein.

Alstar
Larus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 431



BeitragVerfasst: So 03.10.04 11:00 
Titel: ?
Ich habe die Indys noch nie verwendet weil die mir auf den ersten Blick zu kompliziert sin. Aber gut ist das senden dann net schwieriger, oder besser womit funzt es leichter na ja egal hauptsache ist dass da Problem eigentlich gelöst sein sollte und meine Frage kann ich immer noch extra Fragen
Juliman Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 81



BeitragVerfasst: So 03.10.04 11:16 
Nichts ist gelöst... Bei mir haben die beiden die Eigenschaft net... Was soll ich tun?? *g*
Larus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 431



BeitragVerfasst: So 03.10.04 11:21 
Titel: ?????
Die Sockets haben auf jeden fall diese Eigenschaft:

Gehen wir ma davon aus das dein serversocket ServerSocket1 heißt

ausblenden Quelltext
1:
2:
ServerSocket1.Port:=12345;
ServerSocket1.Active:=Enabled;


Bin mir aber nich mehr sicher ob das
ausblenden Quelltext
1:
ServerSocket1.Port:=12345;					


oder

ausblenden Quelltext
1:
ServerSocket1.Socket.Port:=12345;					



heißen muss. Mein Delphi is mit dem Pc-glitch verschwunden
Larus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 431



BeitragVerfasst: So 03.10.04 11:24 
Hab den Client vergessen

ausblenden Quelltext
1:
2:
3:
Clientsocket1.Port:=12345; //int
Clientsocket1.Adress:='127.0.0.1';
ClientSocket1.Active:=True;


Auch hier bin ich mir nich mehr ganz sicher ob nich ein ".Socket" vor .Port und .Adress kommt
Juliman Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 81



BeitragVerfasst: So 03.10.04 16:30 
Bei mir hat er folgende Eigenschaften... WVielleicht kann ja mal jemand das bei sich ausprobieren und dann ein beispiel posten??

1. Active
2. Blockmode
3. LocalHost
4. Name
5. Tag //was ist das ist das richtig das auf null zu stellen??

Danke
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: So 03.10.04 17:21 
mhh. Welche Delphi-Version hast du?

Alstar
Juliman Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 81



BeitragVerfasst: So 03.10.04 22:58 
Ich habe delphi 7
Juliman Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 81



BeitragVerfasst: Mo 04.10.04 18:59 
Ich weiß nicht was ich machen soll! *g*
Ich hoffe mir kann irgendwann jemand helfen!

Danke,
Julian
DracoBlue
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Di 05.10.04 08:25 
Hallo!

Wenn du mit TServerSocket und TClientSocket arbeitest ist das recht simpel.

Form1.OnCreate auf dem Server
ausblenden Delphi-Quelltext
1:
2:
serversocket1.port:=12332;  // KEINE Anführungstriche!!!
serversocket1.open;


Form1.OnCreate auf dem Client
ausblenden Delphi-Quelltext
1:
2:
3:
clientsocket1.port:=12332;  // KEINE Anführungstriche!!!
clientsocket1.host:='192.168.2.2';
clientsocket1.open;


unter umständen sind die tserversocket und tclientsocket nicht standardmäßig bei d7 instaliert, --> Google dazu am besten, dann findest du wie du diese D7-Komponenten in D7 aktiverst.


//EDIT:
Zitat:
Tag //was ist das ist das richtig das auf null zu stellen??

Klick im Objektinspektor auf das Feld von tag und drücke F1 :-D.
Ist nur ein Intwert, den du belegen kannst wie du willst :-P

Mfg, Draco
Juliman Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 81



BeitragVerfasst: Di 05.10.04 12:26 
Jetzt klappts. Ich hatte die falschen Komponenten... Ganz schön doof! Aber da stand auch in klammern Sockets?! Deshalb dachte ich, die richtiger zu haben...

Habe jetzt die Server/Client- Sockets hinzugefügt, und es klappt alles wunderbar..

Aber trotzdem danke!!
Julian