winsock control

hallo i have been able to create a server that accept multiple connections from client

but my problem is this

the connections come in a control erray so how do i send to aparticular client in the control erray

say i have atext box where i in put the ip address of the client


thank yo tom

Comments

  • [b][red]This message was edited by Bulgarian_VB at 2005-7-21 21:18:44[/red][/b][hr]
    [b][red]This message was edited by Bulgarian_VB at 2005-7-21 21:18:15[/red][/b][hr]
    : hallo i have been able to create a server that accept multiple connections from client
    :
    : but my problem is this
    :
    : the connections come in a control erray so how do i send to aparticular client in the control erray
    :
    : say i have atext box where i in put the ip address of the client
    :
    :
    : thank yo tom
    :
    You will have to search. Unfortunately, the object model in Visual Basic doesn't have a collection of objects which captures elements' events. So ... you will need a function. Like this:
    [code]
    'Let's say your control array is named Sockets
    Private Function IPSockets(ByVal IP as String) As WinSock
    Dim i As Integer
    For i = LBound(Sockets) To UBound(Sockets)
    If Sockets(i).RemoteIP = IP Then
    Set IPSockets = Sockets(i)
    Exit Function
    End If
    Next i
    Set IPSockets = Nothing
    End Function
    [/code]

    So ... when you know the integer index you just use:
    [code]
    Sockets(int_index).Send
    [/code]

    And if you know the IP you use the new function:
    [code]
    IPSockets(ip_address).Send
    [/code]


    Hope I helped,
    Nikolay Semov





Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion