Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/rpc: How to judge whether the client is shutdown? #31337

Closed
humyPro opened this issue Apr 8, 2019 · 1 comment
Closed

net/rpc: How to judge whether the client is shutdown? #31337

humyPro opened this issue Apr 8, 2019 · 1 comment

Comments

@humyPro
Copy link

humyPro commented Apr 8, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12.1 windows/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\admin\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\code\gopath
set GOPROXY=direct
set GORACE=
set GOROOT=C:\app\Go
set GOTMPDIR=
set GOTOOLDIR=C:\app\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\code\gopath\local\rawrpcdemo\rawrpc-webService\go.mod
set CGO_CFLAGS=-g -O2

What did you do?

Create an RPC client and server, start the server first, then start the client, and then restart the server, the client's RPC client will appear "connection is shut down" error, just a string. I need to determine if the connection is disconnected, but I can't get the'shutdown'field in Client.

What did you expect to see?

What did you see instead?

@ALTree ALTree added the Question label Apr 9, 2019
@bcmills
Copy link
Contributor

bcmills commented Apr 10, 2019

Note that, per https://tip.golang.org/pkg/net/rpc/, “The net/rpc package is frozen and is not accepting new features.”

Probably you will need to call a method and check for a return value of rpc.ErrShutdown, but it's not obvious to me whether you can do so without additional side-effects.

@bcmills bcmills closed this as completed Apr 10, 2019
@golang golang locked and limited conversation to collaborators Apr 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants