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

  • SEARCH
  • Home
  • 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 7432091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:24:06+00:00 2026-05-29T09:24:06+00:00

Private _clientTCPList As ArrayList = ArrayList.Synchronized(New ArrayList()) ‘ get tcp client Dim clientTCP As

  • 0
Private _clientTCPList As ArrayList = ArrayList.Synchronized(New ArrayList())

' get tcp client
  Dim clientTCP As TcpClient = serverTCP.EndAcceptTcpClient(ar)

' get new ip address from tcp client
   Dim  newClientIPAddress as IPAddress = TryCast(clientTCP.Client.RemoteEndPoint, IPEndPoint).Address

' find new ip-address in tcp-client array list, if ip-address isn't found then add new  
  tcp-client to last index of aray list, but if founded then replace old tcp-client in array list with new tcp-client object.

  Dim i As Integer = 0
  Dim clientIPAddressFound As Boolean = False

  SyncLock _clientTCPList
      For Each t As TcpClient In _clientTCPList
          If t.Client IsNot Nothing Then
              Dim oldClientIPAddress As IPAddress = TryCast(t.Client.RemoteEndPoint, IPEndPoint).Address
              If oldClientIPAddress IsNot Nothing Then
                  If Object.Equals(oldClientIPAddress, newClientIPAddress) Then
                      clientIPAddressFound = True
                      Exit For
                   End If
              End If
          End If
          i += 1
       Next
  End SyncLock

‘ If the more then 1000 client connected to a server,looping to find the objects(ip address) inside array list(tcp clients), takes a long time. Is there a quick methode to replace the manual search of work. Thanks

  • 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-29T09:24:08+00:00Added an answer on May 29, 2026 at 9:24 am

    You can create a HashSet of IP addresses, and keep client IP addresses there. Lookup in hash set does not require a loop: you simply use its Contains(...) method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

private List<String> subList; private List<List<String>> records = new ArrayList<List<String>>(); for(....){ subList = new ArrayList<String>();
private readonly PlayerCollection players = new PlayerCollection(); public PlayerCollection Players { get { return
private ArrayList<String> colors = new ArrayList<String>(); Looking at the example above, it seems the
private static Map<Integer, String> choices = new HashMap<Integer, String>(3); // choices get populated here
private void tbLog_TextChanged(object sender, TextChangedEventArgs e) { //Get only NEW text added to Log
private List<string> _S3 = new List<string>(); public string S3[int index] { get { return
private ArrayList label= new ArrayList(30); Label label_class = new Label(); Random r = new
private void Abc() { string first=; ArrayList result = new ArrayList(); ArrayList secResult =
private string? typeOfContract { get { return (string?)ViewState[typeOfContract]; } set { ViewState[typeOfContract] = value;
private IEnumerable<string> Tables { get { yield return Foo; yield return Bar; } }

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.