I'm sorry. The followings are the complete codes of server and client: Server <https://play.golang.org/p/9vu0GW5a5Y8> Client <https://play.golang.org/p/CmXjfAJSCY7>
Thank you very much! Max Jake Montgomery於 2020年3月25日星期三 UTC+8下午9時28分37秒寫道: > > You do not provide enough information to give a really good answer. There > are a number of ways to achieve this, but they depend on the details. A > more complete example would help. > > What is the type of `ws`? If it is something on which you can set a read > timeout, then one way would be to set a timeout, and loop. > > On Wednesday, March 25, 2020 at 4:10:19 AM UTC-4, 洪嘉鴻 wrote: >> >> Hello everyone: >> The version of the golang which I am using is 1.12.9 with Win10. >> I want to print something while the client is waiting for server. >> The following are the partial code of server and client. >> >> Server: >> time.Sleep(time.Second * 100) >> ws.Write([]byte("Hello!")) >> >> Client: >> while(!ws.Read(msg)){ >> fmt.Println("Please wait because server is busy.") >> } >> >> Can anyone suggest how to fix the code? >> >> Any help is appreciated. >> Thank you very much! >> Max >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d83ed07c-b452-4e9c-98a7-d1853299db5e%40googlegroups.com.