hmmm vb.Net Control Arrays

Discussion in 'Software' started by mastermosley, Oct 12, 2006.

  1. mastermosley

    mastermosley Sergeant

    Ok I have learned that .NET doesn't support Control Arrays. What the hell personally they were the most usefull things in vb6. In everyone of my projects I use them. Well I have also learned that it is still possible, ok here is my predicament.

    I am upgrading a recent project from vb6 to .NET. I have a Catalyst Socket Control which i'm using. In vb6 everytime a person connected a Socket would be created for that person. And it was like:

    Socket(ID) - Like for Each person they get assigned a Number which is the ID. How would I do this in .net. I have the component on .Net also but I need something like a control array, or a nother way.
     
  2. Kodo

    Kodo SNATCHSQUATCH

    knowing nothing about this control it's hard to understand why you need a control array.. can you get more detailed please?
     
  3. mastermosley

    mastermosley Sergeant

    Its a telnet chat server. I run it, when people connect to it creates a new Socket(PersonID). So there is an Array for each person that connected.
     
  4. Kodo

    Kodo SNATCHSQUATCH

    Sorry man, can't help you... there's not enough info. I have no idea about this control and no idea what the array holds and why.. the more info you give (code too) the better we can help.
     
  5. mastermosley

    mastermosley Sergeant

    This is my Vb6 Code For thE Socket Connect. I am trying to convert this to vb:
    Code:
    Private Sub AlemeSocket_Accept(Index As Integer, SocketId As Integer)
        Dim i As Integer
        For i = 1 To LastSocket
            If Not AlemeSocket(i).Connected Then Exit For
        Next i
        If i > LastSocket Then 'Create a new socket, else re-use
            LastSocket = LastSocket + 1: i = LastSocket
            Load AlemeSocket(i)
            Load QuitTimer(i)
        End If
        
        AlemeSocket(i).AddressFamily = AF_INET
        AlemeSocket(i).Protocol = IPPROTO_IP
        AlemeSocket(i).SocketType = SOCK_STREAM
        AlemeSocket(i).Binary = False
        AlemeSocket(i).BufferSize = 1024
        AlemeSocket(i).Blocking = False
        AlemeSocket(i).Accept = SocketId
        
        ConnID = i
        
        'Have we banned this IP
        If IsBanned(AlemeSocket(ConnID).PeerAddress) Then
            'SayFile ConnID, "misc\main.txt"
            'SayFile ConnID, "misc\banned.txt"
            AlemeDisconnect
            Exit Sub
        End If
        
        'If DNSLookup = 1 Then SendData ConnID, "Connected, Please Wait..."
        If BlockLogon = 1 Then
            SayFile ConnID, "misc\main.txt"
            SayFile ConnID, "misc\blocked.txt"
            
            AlemeDisconnect
            Exit Sub
        End If
        If ConnID > (MaxPlayers) Then
            SayFile ConnID, "misc\main.txt"
            SayFile ConnID, "misc\full.txt"
            
            AlemeDisconnect
            Exit Sub
        End If
        
        'TERMTYPE
        'Server   255(IAC),250(SB),24,1,255(IAC),240(SE)
        'Client    255(IAC),250(SB),24,0,'V','T','2','2','0',255(IAC),240(SE)
        
        TTReq$ = Chr$(255) + Chr$(250) + Chr$(24) + Chr$(1) + Chr$(255) + Chr$(240)
        SendData ConnID, TTReq
        ConnInfo(ConnID, 0) = AlemeSocket(ConnID).PeerAddress
        
        Log Trim$(Str$(ConnID)) + " CONNECT From: " + ConnInfo(ConnID, 0)
        Call UpdateConnCount(1)
        
        SayFile ConnID, "misc\main.txt"
        SayFile ConnID, "misc\username.txt"
        SayPrompt ConnID, "Username: "
    End Sub
    
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds