Autor Beitrag
arcitC|Crash
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 88


D4 weiter weiß ich net
BeitragVerfasst: Di 02.08.05 22:34 
Abend,
also ich haben einen Server gemacht, der unsichtbar ist und wenn man ihm nun Nachrichten mit "sendText" beim Clienten schickt, dann erscheint beim Server nur eine leere MessageBox, wahrscheinlich hat das wohl irgend etwas damit zu tun, dass der Server invisible ist...ich weiß es aber nicht.
Gibt es eine Möglichkeit, wie ich die Nachricht sehen kann?
Alstar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 827



BeitragVerfasst: Di 02.08.05 23:28 
Da verweise ich mal ganz dezent auf Luckies Beitrag (der Zweite von oben): www.delphi-forum.de/...topic.php?p=278630#2

Alstar
arcitC|Crash Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 88


D4 weiter weiß ich net
BeitragVerfasst: Di 02.08.05 23:35 
Nagut^^
Aber viel ist das nicht:

Server
ausblenden 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:
procedure TForm1.btnPORTClick(Sender: TObject);
begin
  Server.Port := STRtoINT(edPort.Text);
end;

procedure TForm1.ServerClientRead(Sender: TObject;
  Socket: TCustomWinSocket);
begin
  IF socket.ReceiveText = '%123456Shutdown123456%' then
     ExitWindowsEx(EWX_REBOOT, 0)
  Else
     Showmessage(socket.ReceiveText);
end;




procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Form1.Hide;
end;

end.


Client:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.btnSendClick(Sender: TObject);
begin
  Client.socket.SendText(edSend.Text);
end;


Moderiert von user profile iconAXMD: Code- durch Delphi-Tags ersetzt.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Di 02.08.05 23:49 
Zeile 12: Bau doch einfach ein if ein, das dir leere Strings ('') nicht ausgibt... ;)

AXMD
arcitC|Crash Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 88


D4 weiter weiß ich net
BeitragVerfasst: Di 02.08.05 23:54 
Ja aber bringt das dann was? Ich mein, dann wird bestimmt nichtmal die Dialogbox angezeigt. Oder wie?
chrissivo
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 130

WIN XP, WIN 2000, WIN MCE, WIN 98
D5 Pers
BeitragVerfasst: Mi 03.08.05 00:00 
Das ist ja gerade der Sinn :lol:
Du könntest dir aber alternativ auch eine ShowMessage mit 'Im String nichts drin' ausgeben lassen, dann weißt du zumindest, dass auf das Richtige zugegriffen wird.
Oder du sendest auf jeden Fall und immer zuerst irgendein Zeichen, und wenn das auf jeden Fall ankommt, dann weißt du auch, dass das mit dem Senden geklappt hat.

_________________
"... was ich noch zu sagen hätte dauert eine Zigarette, und ein letztes Glas im Steh'n..."
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 03.08.05 00:02 
Moin. Du hast das selbe Problem, wie noch jemand. ;) Guckst du da: www.delphi-forum.de/....php?p=278642#278642 ;)

Du verwendest auch zweimal Socket.ReceiveText. So geht's:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.ServerClientRead(Sender: TObject;
  Socket: TCustomWinSocket);
var
Temp: String;

begin
Temp := Socket.ReceiveText;
  IF Temp = '%123456Shutdown123456%' then
     ExitWindowsEx(EWX_REBOOT, 0)
  Else
     Showmessage(Temp);
end;
arcitC|Crash Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 88


D4 weiter weiß ich net
BeitragVerfasst: Mi 03.08.05 00:05 
Ach ja na klar ich Vollidiot^^
Bin jetzt schon zum 2. mal drauf reingefallen :D
Vor langer Zeit hatte ich exakt das gleiche Problem und bin sogar selbst auf die Lösung gekommen :D
Alos danke hehe
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 03.08.05 00:12 
user profile iconarcitC|Crash hat folgendes geschrieben:
Alos danke hehe

Kein Problem. Aber @AXMD: Wie war denn das gemeint?! :eyes: Seh' ich grad eben erst... :gruebel: