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 26 Nov. 2003, 23:06
Newsgroups: microsoft.public.dotnet.framework.compactframework
Von: "Richard K" <junkm...@seventree.com>
Datum: Wed, 26 Nov 2003 16:00:55 -0600
Lokal: Mi 26 Nov. 2003 23:00
Betreff: Re: TcpClient.Connect takes 60 seconds
Answering my own question, Socket.Close seems to do the job.  The callback
EndConnect errors out and the thread ends.  And I guess the condition of the
socket afterward doesn't matter if it is recreated for each connect attempt.

"Richard K" <junkm...@seventree.com> wrote in message

news:bq048o$e7fi$1@news3.infoave.net...
> 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