Delphi-PRAXiS
Seite 4 von 5   « Erste     234 5      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi chat funktioniert nicht übers inet =( (https://www.delphipraxis.net/24864-chat-funktioniert-nicht-uebers-inet-%3D.html)

fiasko 1. Jul 2004 15:28

Re: chat funktioniert nicht übers inet =(
 
Zitat:

Zitat von Spurius
Im Router hab ich den benutzten Port geforwarded, was mach ich falsch?

Du sitzt also auch hinter'nem Router? Kannst du dir nicht von diesem direkt sagen lassen was seine oeffentliche IP-Adresse ist?

Spurius 1. Jul 2004 16:30

Re: chat funktioniert nicht übers inet =(
 
Hinter dem Router sind aber mehrere PC's. Da ist meiner ja nicht genau bestimmt :(

fiasko 1. Jul 2004 21:16

Re: chat funktioniert nicht übers inet =(
 
Was ich meinte ist: ich schätze mal das ist ein Hardware-Router der über ne WWW-Seite oder sowas konfiguriert wird. Gibt es da nicht irgendwo die Info welche öffentliche IP er gerade bekommen hat?

Torsten Borstensohn 1. Jul 2004 21:25

Re: chat funktioniert nicht übers inet =(
 
Ich denke, für jeden Client, der sich einloggen will, muss eine neue Winsock-Instanz gebildet werden, also so eine Art Array. Ich habe dazu in einem anderen Forum mal den Code gefunden. Leider kann ich heute die Quelle nicht mehr angeben.

procedure ...
var
i:integer;
sRec : string;
begin
for i := 0 to ServerSocket1.Socket.ActiveConnections-1 do
begin
with ServerSocket1.Socket.Connections[i] do
begin
sRec := ReceiveText;
if sRec <> '' then
begin
Memo1.Lines.Add(RemoteAddress + ' sends :') ;
Memo1.Lines.Add(sRecr);
end;
end;
end;
end;

Spurius 1. Jul 2004 21:34

Re: chat funktioniert nicht übers inet =(
 
Hallo,
ich verwende die Indys. Ich schau mir das Routermenü nochmal genauer an.

Aenogym 1. Jul 2004 21:44

Re: chat funktioniert nicht übers inet =(
 
Mal ein anderer Vorschlag: Die TDXPlay-Komponente aus der DelphiX-Sammlung!
Ich bin auch an normalen TCP-Komponenten gescheitert und greife nun zur DXPlay-Kompo.

Vorteile:
-Keine Client-/Server-Architektur (kann ggf. auch als Nachteil angesehen werden)
-Auf eingehende Daten kann in einem Event reagiert werden.
-Ganz einfache Handhabung

Nur so als Tipp ;)

Aenogym

fiasko 1. Jul 2004 21:48

Re: chat funktioniert nicht übers inet =(
 
Leute, ihr seit OT - habt ihr den Thread mal gelesen worum es hier eigentlich geht :gruebel:

Spurius 2. Jul 2004 12:32

Re: chat funktioniert nicht übers inet =(
 
Hallo,
@Fiasko: Meinst du mich?
Ich hab nochmal im Routermenü nachgeschaut, aber bin nicht weitergekommen.

fiasko 2. Jul 2004 12:40

Re: chat funktioniert nicht übers inet =(
 
Ne ich meinte die anderen 2 Postings...

Torsten Borstensohn 4. Jul 2004 14:32

Re: chat funktioniert nicht übers inet =(
 
Der Server muss für jede Anfrage eines Client einen neuen Thread bilden:

http://www.howtodothings.com/showart...sp?article=522

"How do we handle more than one client requests at a time?

The answer is to spawn a new thread for each client request. This can be achieved by setting the ServerType property to stThreadBlocking. Does spawning and destroying a thread for each client request an overhead? Yes. Obviously. But if our application design requires it, then there is no other way; you have to have that overhead. Can we reduce that overhead of creating and destroying threads? Yes. We can. How? Cache those threads. Right.
The ThreadCacheSize property serves that purpose. The default value is 10 but this value depends on your client application needs. You should be very careful in setting this value. If you set it to a maximum value, you will end up in memory problems. If you set it to a very low value, the client will have a wait time for each request. So you have to determine a best value based on the client statistics.

If the client requests are coming one at a time, then you can set the ServerType property to stNonBlocking."


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:46 Uhr.
Seite 4 von 5   « Erste     234 5      

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz