Autor Beitrag
oOXTCOo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 141

Windows XP Prof. 3
Delphi 7
BeitragVerfasst: Di 08.06.04 02:35 
hallo alle!

ich brauche schon wieder dringen eure hilfe.

ich möchte ein screenshot vom server zu clienten senden.
mit den komponenten tserver / Tclientsocket.

das mit den screenshots bekomm ich hin aber die bild datei dann
an den clienten zu senden, bekomm ich einfachn nicht hin.
es kommt immer eine datei mit 0 kb an.

vieleicht könnte mir jemand eine kleine (einfache) demo senden?
ich suche schon seit 16:00 uhr bis jetzt 2:30 und ich komm einfach nicht weiter.
für jede hilfe währe ich dankbar.
wenn sich jemand das programm ansehen will, dann werde ichs mailen.
den quelltext will ich deshalb hir nicht posten da er schon so gross ist und ich keine ahnung hab welchen teil ich hir reinposten sollte, weil das schon ein ziemliches durcheinander ist.

meine email adr.: speedfreak@gmx.at


mfg. hari

PS: meine zwei programme (Server + Client) hab ich in diesem www.delphipraxis.net...st186240.html#186240 forum gepostet!


Zuletzt bearbeitet von oOXTCOo am Mi 09.06.04 02:34, insgesamt 1-mal bearbeitet
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 08.06.04 11:52 
wenn du es via INDY kompos machen willst, dann gibt es von INDY selber bereits ein Demo dazu !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
oOXTCOo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 141

Windows XP Prof. 3
Delphi 7
BeitragVerfasst: Di 08.06.04 17:21 
Titel: @ maze
matze hat folgendes geschrieben:
wenn du es via INDY kompos machen willst, dann gibt es von INDY selber bereits ein Demo dazu !


nein ich hab jetzt schon so lange daran gearbeitet, und das möcht ich jetzt nicht mehr alles auf die indy komponenten umstellen.

mfg hari
oOXTCOo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 141

Windows XP Prof. 3
Delphi 7
BeitragVerfasst: Di 08.06.04 20:20 
kann mir den da keiner weiter helfen??? :cry:
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 08.06.04 23:55 
also im prinzip brauchst du doch nen code mit dem du streams verschcken kannst oder ? da wird sich doch was finden lassen...

_________________
In the beginning was the word.
And the word was content-type: text/plain.
oOXTCOo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 141

Windows XP Prof. 3
Delphi 7
BeitragVerfasst: Mi 09.06.04 00:57 
matze hat folgendes geschrieben:
also im prinzip brauchst du doch nen code mit dem du streams verschcken kannst oder ? da wird sich doch was finden lassen...


ja den code hab ich e, aber es kommen immer nur 8,00Kb an!
ein gif bild zb. kann ich (bei einer grösse von ca. 100kb) dann nur zu einem viertel sehen.
oOXTCOo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 141

Windows XP Prof. 3
Delphi 7
BeitragVerfasst: Mi 09.06.04 02:33 
Titel: dateien über die tsocket Server /Client Kompnenten senden
ich habs geschaft!!! jetzt kann ich entlich auch vom client zum server senden ohne das nur 8,00kb ankommen, und zwar so:

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:
 unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    ServerSocket1: TServerSocket;
    Label1: TLabel;
    procedure ServerSocket1ClientConnect(Sender: TObject;
      Socket: TCustomWinSocket);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
    FStream: TFileStream;
implementation

{$R *.dfm}

procedure TForm1.ServerSocket1ClientConnect(Sender: TObject;
  Socket: TCustomWinSocket);
begin
   FStream := TFileStream.Create('C:\temp\screenshothari.bmp', fmOpenRead);
Socket.SendStream(FStream);
end;

end.


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:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    ClientSocket1: TClientSocket;
    Label1: TLabel;
    Button1: TButton;
    procedure ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
    procedure Button1Click(Sender: TObject);
    procedure ClientSocket1Connect(Sender: TObject;
      Socket: TCustomWinSocket);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
   FStream: TFileStream;
  SizeOfFile: Integer;
  pBuffer: Pointer;
   AlreadyReceived: integer;
     FileStream: TFileStream;
     Buffer: array[0..4096] of Byte; // die Größe des Puffers ist beliebig, müsste nur (s.u.)
 SizeOfBuffer: integer;

implementation

{$R *.dfm}

procedure TForm1.ClientSocket1Read(Sender: TObject;
  Socket: TCustomWinSocket);
var

 Buffer: array[0..4096] of Byte; // die Größe des Puffers ist beliebig, müsste nur (s.u.)
 SizeOfBuffer: integer;

  begin
 pBuffer := @Buffer;
  SizeOfBuffer := Socket.ReceiveBuf(pBuffer^, 4096); //hier angeglichen werden
  FileStream.Write(pBuffer^, SizeOfBuffer);
  Inc(AlreadyReceived, SizeOfBuffer);
  Socket.SendText(IntToStr(AlreadyReceived));

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
ClientSocket1.Active:=false;
filestream.Free;
end;

procedure TForm1.ClientSocket1Connect(Sender: TObject;
  Socket: TCustomWinSocket);
begin
    FileStream := TFileStream.Create('c:\temp\datei2.bmp', fmCreate or fmOpenWrite);
end;

end.



mfg. hari