Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Sleep aber ohne Prozeß zu stoppen

Empfohlene Antworten

Veröffentlicht

Moin,

habe folgendes Problem.... Ein Winsock Steuerelement soll eine TCP Verbindung aufbauen.... und dann Daten schicken...

zwischen dem schicken und verbinden brauche ich aber eine Pause, sonst gehts nicht.... habe ich mit zwei Buttons probiert!

So wenn ich Sleep oder eine eigene Prozedur benutze um zu warten.... dann stop der Connect-Prozeß!!! Wie kann ich das umgehen??? Mit DoEvents klappt es irgendwie nicht...

schon mal mit nem Timer probiert?

Ja klar... geht nicht

falls du das problem hast, das der Verbindungsvorgang etwas länger dauert und schon versucht wird zu senden, sollte folgendes helfen:

do

doevents

loop while winsock1.state <> 7

Hier sollte noch eine Überprüfung vorgenommen werden, denn wenn z.B. eine falsche Adresse eingegeben wird, haben wir eine Endlos Schleife.

hiro

Das Problem ist, das ich versuchen will Rechner im Netzwerk auszuspüren, die einen bestimmten offenen Port haben! Diese Rechner sollen dann auf meine Anfrage hin einen String zurück schicken... das klappt auch , aber nicht in einer schleife! Was kann ich tun?

Mit Schleife meinst du, das du mehrere Rechner testen willst oder??? Ist jetzt dein Problem erstmal festzustellen ob der PC an ist und den Port offen hat oder ist der PC definitiv an und es kann sein, das der Port offen ist???

hiro

Hi,

hab hier einen Port-Scanner-Code, is zwar net von mir, aber verdammt schnell.

Wsk heisst das Winsock-Element

Die anderen Elemente wirst'e schon finden ;)

-------------Snip----------

Public Max_Con

Public Max_Port

Public Last_Checked

Public url As String

Private Is_ready(33999) As Ready

Private Type Ready

Value As Integer

End Type

Private Sub Command1_Click()

blah = InputBox("How Many Sockets? (500 is good)", HowMany, 500)

Max_Con = blah

For x = 1 To blah

Load Wsk(x)

Next x

End Sub

Private Sub Command2_Click()

url = InputBox("URL to SCAN", , "localhost")

Me.Caption = url

Max_Port = InputBox("Maximum port to scan")

Call Check

End Sub

Private Sub Timer1_Timer()

Label3.Caption = Val(Label3.Caption) + 1 & " Second/s"

End Sub

Private Sub Wsk_Connect(Index As Integer)

Label1.Caption = "Last Checked In: " & Wsk(Index).RemotePort

List1.AddItem Index, 0

Wsk(Index).Close: Is_ready(Index).Value = 0 'set socket ready

End Sub

Private Sub Wsk_Error(Index As Integer, ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)

Label1.Caption = "Last Checked In: " & Wsk(Index).RemotePort

Wsk(Index).Close: Is_ready(Index).Value = 0 'set socket ready

End Sub

Sub Check()

Strt:

Timer1.Enabled = True

DoEvents

For x = 1 To Max_Con

DoEvents

'Wsk(x).Close This is Bad!!

If Is_ready(x).Value <> 0 Then GoTo 20: ' Socket Isnt done checking skip

Wsk(x).Connect url, Last_Checked + 1

Is_ready(x).Value = 1 'Set socket not ready

Last_Checked = Last_Checked + 1

Label2.Caption = "Next To Be Scanned: " & Last_Checked

20:

Next x

If Val(Last_Checked) >= Val(Max_Port) Then

Timer1.Enabled = False

For y = 1 To Max_Con

'Clean Up

Is_ready(y).Value = 0

Unload Wsk(y)

Next y

MsgBox ("Stoped")

Exit Sub

Else:

GoTo Strt:

End If

End Sub

-------------Snip----------

Hth

KarlBerg

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.