Google Mail Kalender Text & Tabellen Reader Web Mehr »
Kürzlich besuchte Gruppen | Hilfe | Anmelden
Google Groups-Startseite
Nachricht von Diskussion TcpClient.Connect takes 60 seconds
Bei der Gruppe, für die Sie eine Mitteilung verfassen, handelt es sich um eine Usenet-Gruppe. Wenn Sie in dieser Gruppe Nachrichten posten, ist Ihre E-Mail-Adresse für jeden im Internet sichtbar
Ihre Antwort wurde nicht gesendet.
Die Nachricht wurde übermittelt.
 
Von:
An:
Cc:
Nachtrag zu:
Cc hinzufügen | Nachtrag hinzufügen zu | Betreff bearbeiten
Betreff:
Bestätigung:
Geben Sie zur Bestätigung die im folgenden Bild angezeigten Zeichen oder die durchgesagten Zahlen ein, indem Sie auf das Eingabesymbol klicken. Hören Sie zu und geben Sie die gehörten Zahlen ein
 
Richard K  
Profil anzeigen   Übersetzen in die Sprache: Übersetzt (Original anzeigen)
 Weitere Optionen 25 Nov. 2003, 18:42
Newsgroups: microsoft.public.dotnet.framework.compactframework
Von: "Richard K" <junkm...@seventree.com>
Datum: Tue, 25 Nov 2003 11:39:58 -0600
Lokal: Di 25 Nov. 2003 18:39
Betreff: Re: TcpClient.Connect takes 60 seconds
That might work - I don't know, I have already changed the code to use
Socket.BeginConnect/EndConnect which connects instantly using the same IP
address string.  But that brings up another question...

In the desktop .NET framework WaitOne(delay in ms) can be used after
BeginConnect to limit the time allowed for a conection attempt.  But the CF
version of WaitOne does not accept a time limit.  I have seen suggestions
that Thread.Sleep be used instead, followed by testing a boolean that is set
on in the callback if the EndConnect executes normally.  If this bool is not
set after Sleep then the connection has not completed.

My question is, in that case isn't the callback thread still waiting on
EndConnect?  And if so how can the program terminate it - preferably leaving
the Socket in a state that will allow the user to make another connection
attempt.  (It is my impression that "desktop" WaitOne kills the thread if it
times out, but I could be mistaken about that also.)

Dick

""David Kline [msft]"" <davi...@online.microsoft.com> wrote in message
news:44%23PfzusDHA.3024@cpmsftngxa07.phx.gbl...

> Richard,

> Chances are, the delay you are seeing is due to the TcpClient attempting
to
> resolve the hostname.  Since your hostname is an IPAddress, you may wish
to
> eliminate the resolution step by replacing your code with the following:

> MyTcpClient.Connect(IPAddress.Parse("192.168.1.1"), 8222);

> Thanks,
> David Kline
> Microsoft .NET Compact Framework
> --------------------------------
> This posting is provided "AS IS" with no warranties, and confers no
> rights.

> Please do not send email directly to this alias. This alias is for
> newsgroup purposes only. To correspond with me directly, remove the
> 'online' from
> my alias.


    Weiterleiten  
Sie müssen sich anmelden, bevor Sie Nachrichten veröffentlichen können.
Bevor Sie eine Nachricht posten können, müssen Sie zunächst dieser Gruppe beitreten.
Bitte aktualisieren Sie vor dem Posten in den Abonnementeinstellungen Ihren Spitznamen.
Sie haben nicht die erforderliche Berechtigung zum Posten.

Eine Gruppe erstellen - Google Groups - Google-Startseite - Nutzungsbedingungen - Datenschutzbestimmungen
©2010 Google