Autor Beitrag
Niko S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 566
Erhaltene Danke: 10

Win 7, Ubuntu
Lazarus, Turbo Delphi, Delphu 7 PE
BeitragVerfasst: Mo 12.11.07 22:49 
Zitat:
---------------------------
Benachrichtigung über Debugger-Problem
---------------------------
In Projekt BLABLUBB\Projects\Project1.exe trat ein Problem mit folgender Meldung auf: 'Zugriffsverletzung bei 0x400095d1: Schreiben von Adresse 0x00030dc8'. Prozess angehalten. Mit Einzelne Anweisung oder Start fortsetzen.
---------------------------
OK
---------------------------



Client:
ausblenden volle Höhe Delphi-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:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Memo2: TMemo;
    ClientSocket1: TClientSocket;
    Button1: TButton;
    procedure Memo2KeyPress(Sender: TObject; var Key: Char);
    procedure FormShow(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

type
  CustomRec = record
    Text: String;
    Zahl: byte;
  end;

implementation

{$R *.dfm}

procedure TForm1.Memo2KeyPress(Sender: TObject; var Key: Char);
var Rec: CustomRec;
begin
  if (Key = #13then
  begin
    key := #0;
    Rec.Text := Memo2.Text;
    Rec.Zahl := 1;
    if (ClientSocket1.Active = True) then
      ClientSocket1.Socket.SendBuf(Rec,SizeOf(Rec));
    Memo1.Lines.Add('['+TimeToStr(Time)+'] : '+Memo2.Text);
    Memo2.Clear;
  end;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  Memo2.SetFocus;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ClientSocket1.open;
  Memo1.Lines.Add(format('[%s] : %s',[TimeToStr(TIME),'Opened Connection to Server....']));
end;

end.


und Server
ausblenden volle Höhe Delphi-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:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
unit Unit2;

interface

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

type
  TForm2 = class(TForm)
    Memo1: TMemo;
    ServerSocket1: TServerSocket;
    procedure FormCreate(Sender: TObject);
    procedure ServerSocket1ClientRead(Sender: TObject;
      Socket: TCustomWinSocket);
    procedure ServerSocket1ClientConnect(Sender: TObject;
      Socket: TCustomWinSocket);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form2: TForm2;

implementation

type
  CustomRec = record
    Text: String;
    Zahl: byte;
  end;
{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
begin
  ServerSocket1.open;
  Memo1.Lines.Add('Server Activated....');
  Memo1.Lines.Add('Open on Port: 7544');
  Memo1.Lines.Add('Wait for Clients....');
end;

procedure TForm2.ServerSocket1ClientRead(Sender: TObject;
  Socket: TCustomWinSocket);
  var Rec: CustomRec;
begin
  ServerSocket1.Socket.connections[0].ReceiveBuf(Rec,SizeOf(Rec));
  Memo1.Lines.Add(Rec.Text);
end;

procedure TForm2.ServerSocket1ClientConnect(Sender: TObject;
  Socket: TCustomWinSocket);
begin
  Memo1.Lines.Add('Someone Connected...');
end;

end.



So nun Ganz oben ist die Fehlermeldung die ich bekomme wenn ich etwas in der form wo der Server drauf ist ausgeben will (z.b. ins memo schreiben)

Genau dann bekomme ich den Zugriffsfehler und ich weis nicht warum...
Hat vielleich wer einen Vorschlag?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 12.11.07 23:07 
Moin!

user profile iconSimak hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
type
  CustomRec = record
    Text: String;
    Zahl: byte;
  end;

Fehler-Klassiker, kuckst du in die FAQ. :les: ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.