Also ich code zurzeit aus fun nen RAT...
Ich bin immer noch am anfang und habe ein Problem mit dem ich nicht weiterkomme.
Und zwar geht es um eine listbox.
wenn ich eine Connection reinbekomme fügt es die gleich zur Liste hinzu...
soo dann hab ich ein timer der alle paar sekunden überprüft ob die connections noch aktuell sind... das funktioniert auch alles ganz gut nur halt 1mal ^^
denn die connection wird immer nur einmal angezeigt und wenn eine neue kommt zeigt er diese nicht an.. aber er scheint sie an zu nehmen....
ich poste hier einfach mal den gesamten Code
Form1:
1xcounter
1xlistbox
150xwinsock control
Code:
Public myindex As Integer
Private Sub Form_Load()
myindex = 0
Winsock1(myindex).Listen
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
Dim a As Integer
a = Winsock1.count - 1
Dim i As Integer
For i = 0 To 10
If Winsock1(i).State = 8 Then
List1.RemoveItem (getindexpername(binding(i)))
End If
Next
End Sub
Private Sub Winsock1_ConnectionRequest(Index As Integer, ByVal requestID As Long)
Winsock1(Index).Close
Winsock1(Index).Accept requestID
binding(Index) = "none" & vbTab & Index
List1.AddItem "none" & vbTab & Index
List1.ListIndex = List1.ListCount - 1
List1.Refresh
myindex = myindex + 1
Winsock1(myindex).Listen
End Sub
Public Function getindexpername(ByVal name As String)
Dim i As Integer
Dim count As Integer
i = List1.ListCount - 1
For count = 0 To i
Dim that As String
that = List1.List(count)
If that = name Then
getindexpername = count
End If
Next
End Function
Modul1:
Code:
Public binding(150) As String
Hilfe plz!