Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7534633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:04:37+00:00 2026-05-30T06:04:37+00:00

I am trying to create an IP disconnector. This is part from a template

  • 0

I am trying to create an IP disconnector. This is part from a template that I took that creates a TCPtable. I was trying to add a disconnecting function. However, it does not disconnect.

    Dim liste() = {"76.9.24.130" ... ... ...}
    Dim pdwSize As Integer
    Dim iRetVal As Integer
    Dim i As Integer
    Dim TcpTableRow As MIB_TCPROW
    Dim pStructPointer As IntPtr = IntPtr.Zero
    Dim iNumberOfStructures As Integer
    ListView1.Items.Clear()
    iRetVal = GetTcpTable(pStructPointer, pdwSize, 0)
    pStructPointer = Marshal.AllocHGlobal(pdwSize)
    iRetVal = GetTcpTable(pStructPointer, pdwSize, 0)
    iNumberOfStructures = Math.Ceiling((pdwSize - 4) / Marshal.SizeOf(GetType(MIB_TCPROW)))
    For i = 0 To iNumberOfStructures - 1
        Dim pStructPointerTemp As IntPtr = New IntPtr(pStructPointer.ToInt32() + 4 + (i * Marshal.SizeOf(GetType(MIB_TCPROW))))
        TcpTableRow = New MIB_TCPROW()
        With TcpTableRow
            .dwLocalAddr = 0
            .dwState = 0
            .dwLocalPort = 0
            .dwRemoteAddr = 0
            .dwRemotePort = 0
        End With
        'Marshal.PtrToStructure(pStructPointerTemp, TcpTableRow)
        TcpTableRow = CType(Marshal.PtrToStructure(pStructPointerTemp, GetType(MIB_TCPROW)), MIB_TCPROW)
        ' Process each MIB_TCPROW here
        'If Not ((Check1.CheckState = System.Windows.Forms.CheckState.Checked) And (GetIpFromLong(TcpTableRow.dwLocalAddr) = "0.0.0.0" Or GetIpFromLong(TcpTableRow.dwLocalAddr) = "127.0.0.1")) Then
        If Not GetIpFromLong(TcpTableRow.dwRemoteAddr) = "127.0.0.1" And Not GetIpFromLong(TcpTableRow.dwRemoteAddr) = "0.0.0.0" Then
            'Add the data to the ListView control
            With TcpTableRow
                Dim itemAdd As ListViewItem
                itemAdd = ListView1.Items.Add(GetIpFromLong(.dwLocalAddr))
                itemAdd.SubItems.Add(CStr(GetTcpPortNumber(.dwLocalPort)))
                itemAdd.SubItems.Add(GetIpFromLong(.dwRemoteAddr))
                itemAdd.SubItems.Add(CStr(GetTcpPortNumber(.dwRemotePort)))
                itemAdd.SubItems.Add(GetState(.dwState))
            End With
            '-------------- Kill Connection--------------
            If Array.IndexOf(liste, GetIpFromLong(TcpTableRow.dwRemoteAddr)) >= 0 Then
                TcpTableRow.dwState = 12
                SetTcpEntry(TcpTableRow)
            End If
        End If
    Next
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:04:38+00:00Added an answer on May 30, 2026 at 6:04 am

    I could not solve it but found an alternative solution using CurrPorts

     Shell(Application.StartupPath & "\cports /close * * " & GetIpFromLong(TcpTableRow.dwRemoteAddr) & " " & GetTcpPortNumber(TcpTableRow.dwRemotePort))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying create this function such that if any key besides any of the
I am trying create a WCF service that leverages the WPF MediaPlayer on the
Trying to create my first iPhone app that would play back audio. When I
Trying to create a small monitor application that displays current internet usage as percentage
I'm using VB6 and trying to create a DAO recordset from an array of
I'm trying to create a client-server program that send and receive a string (its
I am trying create a small web application that allows a user to login
I am trying to create a simple test HTML page which shows messages from
Hi i'm trying to create a sever/client program that takes up to 5 clients
I'm trying to create a demo website using websockets that will be a simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.