logo-MindMajix
PostGoLangGoLang
s
sri kanth

Posted on 26th July 2024|95 views

0
votes

Golang Select Timeout

golang select timeoutgolang select timeout

1 answers
Answers
P
Lakshmi sowjanya

Posted on 26th July 2024| views

Timeouts are great for programs which connect toward the external resources or else that unless the necessary to bound execution time. Executing timeouts within Go is simple and elegant thanks to channels including select. Here is an example:

import "time"

c := make(chan error, 1)

go func() { c <- client.Call("Service.Method", args, &reply) } ()

select {

  case err := <-c:

      case <-time.After(timeoutNanoseconds):

    }

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo

  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos
Name
Course *
Email *
Phone Number