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 6541225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:04:43+00:00 2026-05-25T11:04:43+00:00

When I am doing : Array.Clear(Core.arrayRead,0 , 1024) let cBytes = Core.socket.Receive(Core.arrayRead, 1024, SocketFlags.None)

  • 0

When I am doing :

Array.Clear(Core.arrayRead,0 , 1024)
let cBytes = Core.socket.Receive(Core.arrayRead, 1024, SocketFlags.None)

First time (with empty array) it works good, but next time when I am clearing my array to receive new bytes I’ve got this error : Collection was modified; impossible to perform the operation listings

Is it still clearing ? or what ? How can I fix it ?

more code :

try
    Core.listPos |> Seq.iter /> fun op ->
        Core.socket.Send(op.Buffer) |> ignore
        Array.Clear(Core.arrayRead,0 , 1024)
        let cBytes = Core.socket.Receive(Core.arrayRead, 1024, SocketFlags.None) // error ->
        if  cBytes > 0 then
            Core.WorkPos cBytes
with
    | :? SocketException as e   -> Core.output.Add ("Ошибка протокола связи : "    + e.Message)
    | _ as e                    -> Core.output.Add ("Ошибка : "                    + e.Message) // My error here 
  • 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-25T11:04:44+00:00Added an answer on May 25, 2026 at 11:04 am

    just wanted to conclude, if someon reads this or got a similiar question in the future:

    The problem was the Core.listPos collection and the Seq.iter in

    Core.listPos |> Seq.iter /> fun op ->
       ...
    

    not the socket.Receive, because the listPos got changed from another thread.
    Seq.iter will (just as foreach in C#) throw such exceptions if the collection changes (most often this is due to some .Remove inside the loops-body).

    An easy solution would be to write

    let positions = Core.listPos |> Seq.toArray
    positions |> Seq.iter /> fun op -> ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have an array, and I know I'm going to be doing
What is the advantage of doing this: NSArray *array = [[NSArray alloc] initWithObjects:@Year, @Capital,
I am doing some calculations that require a large array to be initialized. The
I need to create a 2D int array of size 800x800. But doing so
I need to random some elements from an array. I'm doing that by randomizing
I am an old time user of the Array of controls in VB back
I am doing an assignment for school and I am using an array filled
To do the equivalent of Python list comprehensions, I'm doing the following: some_array.select{|x| x
I'm finding myself doing a lot of things with associative arrays in PHP. I
I'm concatenating a large number of byte[] arrays in C#. If I were doing

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.