blocto / solana-go-sdk

Solana Golang SDK
https://blocto.github.io/solana-go-sdk/
MIT License
366 stars 95 forks source link

Only one usage of each socket address (protocol/network address/port) is normally permitted. #111

Closed femtoeu closed 1 year ago

femtoeu commented 1 year ago

Hello, i'm trying to recieve sol balance for 5000 accounts in 200 goroutines and i'm get this error:

get sol balance err: rpc: call error, err: failed to do request, err: Post "http://69.197.13.4:8080": dial tcp 69.197.13.4:8080: connectex: Only one usage of each socket address (protocol/network address/port) is normally permitted., body:

I'm using single client instance and for some reason it creates too many open connections and never closes them. Is this package not supports concurrency?

Here is my code:

client    = solana.NewClient("http://69.197.13.4:8080")
addresses := make(chan string)
for i := 0; i < 200; i++ {
  for address := range addresses {
      solBalance, err := client.GetBalance(context.Background(), address)
      if err != nil {
          log.Printf("get sol balance err: %s", err.Error())
          continue
      }
  }
}