TCP Warten bis 3 clients connecten

  • hi,
    also ich hänge an einer eigendlich simplen sache,
    der server soll solange in einer schleife bleiben, bis 3 clients accepted wurden°!
    allerdings bin ich entweder zu blöd oder hab ein brett vorm kopf o0
    ich weiß selbst das so wie ich es hier poste $connected maximal 1 wird o0
    aber mir fällt nix ein wie ich alle 3 clients angenommen bekomme o0
    und zwar am besten, dass jeder client ne eigene variable zugewiesen bekommt! also keine array!

    [autoit]


    write("Function search_sockets()")
    write("awaiting connections")
    $connected = 0
    while $connected <3
    traytip("TA-Spiker","awaiting connections"&@lf&$connected,5)
    $ConnectedSocket1 = -1
    $ConnectedSocket2 = -1
    $ConnectedSocket3 = -1
    $ConnectedSocket1 = TCPAccept($MainSocket)
    if $ConnectedSocket1 <> -1 Then
    $connected = 1
    $ConnectedSocket2 = TCPAccept($MainSocket)
    if $ConnectedSocket2 <> -1 Then
    $connected = 2
    $ConnectedSocket3 = TCPAccept($MainSocket)
    if $ConnectedSocket3 <> -1 Then
    $connected = 3
    EndIf
    EndIf
    EndIf
    WEnd
    msgbox(0,"Server","all clients accepted")
    endfunc

    [/autoit]

    Einmal editiert, zuletzt von azunai (20. April 2008 um 21:48)

  • [autoit]

    write("Function search_sockets()")
    write("awaiting connections")
    $connected = 0
    Do
    traytip("TA-Spiker","awaiting connections"&@lf&"1",5)
    $ConnectedSocket1 = TCPAccept($MainSocket)
    Until $ConnectedSocket1 <> -1
    Do
    traytip("TA-Spiker","awaiting connections"&@lf&"2",5)
    $ConnectedSocket2 = TCPAccept($MainSocket)
    Until $ConnectedSocket2 <> -1
    Do
    traytip("TA-Spiker","awaiting connections"&@lf&"3",5)
    $ConnectedSocket3 = TCPAccept($MainSocket)
    Until $ConnectedSocket3 <> -1

    [/autoit][autoit][/autoit][autoit]

    msgbox(0,"Server","all clients accepted")
    endfunc

    [/autoit]