Thanks to visit codestin.com
Credit goes to github.com

Skip to content

net/rpc: access to client's IP address #4584

Closed
@gopherbot

Description

@gopherbot

by visan.ovidiu:

Right now RemoteAddr() method can be called to get the RPC client's address only on
net.Conn when the client dials to server, but suppose that your server has multiple
clients connected and each of this clients are calling an RPC exported method. Is there
a way to implement a method to get the caller's remote address from inside the RPC
method?

func (t *Type) Method(args *Args, reply *string) error {
    //something like
        *reply = Caller.RemoteAddr().String()
        // who called the method now?
    return nil
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions