Artemis - getRemoteAddress returns address starting with /

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Artemis - getRemoteAddress returns address starting with /

Modanese, Riccardo
Hello, the method getRemoteAddress of the RemotingConnection object returns an address starting with '/'.

Is it working as expected (and in this case is there any reason to have an address starting with '/') or it's a bug?



Regards

Riccardo
Reply | Threaded
Open this post in threaded view
|

Re: Artemis - getRemoteAddress returns address starting with /

wei yang
The method getRemoteAddress of the RemotingConnection returns
InetSocketAddress::toString which calls InetAddress::toString. And the
comment says:

Converts this IP address to a {@code String}. The
* string returned is of the form: hostname / literal IP
* address.
*
* If the host name is unresolved, no reverse name service lookup
* is performed. The hostname part will be represented by an empty string.


Modanese, Riccardo <[hidden email]> 于2019年8月22日周四
下午4:48写道:

> Hello, the method getRemoteAddress of the RemotingConnection object
> returns an address starting with '/'.
>
> Is it working as expected (and in this case is there any reason to have an
> address starting with '/') or it's a bug?
>
>
>
> Regards
>
> Riccardo
>
Reply | Threaded
Open this post in threaded view
|

Re: Artemis - getRemoteAddress returns address starting with /

Modanese, Riccardo
How the method evaluates the return value it’s now clear for me but it’s not clear the reason to have such return value.
From my point of view a method called getRemoteAddress should return just an IP address.

Otherwise any code that needs to use the remote client ip must use a workaround to clenup it.
 

> Il giorno 23 ago 2019, alle ore 03:41, yw yw <[hidden email]> ha scritto:
>
> The method getRemoteAddress of the RemotingConnection returns
> InetSocketAddress::toString which calls InetAddress::toString. And the
> comment says:
>
> Converts this IP address to a {@code String}. The
> * string returned is of the form: hostname / literal IP
> * address.
> *
> * If the host name is unresolved, no reverse name service lookup
> * is performed. The hostname part will be represented by an empty string.
>
>
> Modanese, Riccardo <[hidden email]> 于2019年8月22日周四
> 下午4:48写道:
>
>> Hello, the method getRemoteAddress of the RemotingConnection object
>> returns an address starting with '/'.
>>
>> Is it working as expected (and in this case is there any reason to have an
>> address starting with '/') or it's a bug?
>>
>>
>>
>> Regards
>>
>> Riccardo
>>

Reply | Threaded
Open this post in threaded view
|

Re: Artemis - getRemoteAddress returns address starting with /

jbertram
The JavaDoc for getRemoteAddress() says, "Returns a string representation
of the remote address this connection is connected to." The key word here
is "string." In other words, it is meant to be printed or otherwise used
for informational purposes. If code actually wanted to use the address for
some other kind of network operation RemotingConnection would need to be
updated to return the actual SocketAddress object.  Feel free to send a PR
if that's what you need.


Justin

On Mon, Aug 26, 2019 at 5:07 AM Modanese, Riccardo
<[hidden email]> wrote:

> How the method evaluates the return value it’s now clear for me but it’s
> not clear the reason to have such return value.
> From my point of view a method called getRemoteAddress should return just
> an IP address.
>
> Otherwise any code that needs to use the remote client ip must use a
> workaround to clenup it.
>
>
> > Il giorno 23 ago 2019, alle ore 03:41, yw yw <[hidden email]> ha
> scritto:
> >
> > The method getRemoteAddress of the RemotingConnection returns
> > InetSocketAddress::toString which calls InetAddress::toString. And the
> > comment says:
> >
> > Converts this IP address to a {@code String}. The
> > * string returned is of the form: hostname / literal IP
> > * address.
> > *
> > * If the host name is unresolved, no reverse name service lookup
> > * is performed. The hostname part will be represented by an empty string.
> >
> >
> > Modanese, Riccardo <[hidden email]>
> 于2019年8月22日周四
> > 下午4:48写道:
> >
> >> Hello, the method getRemoteAddress of the RemotingConnection object
> >> returns an address starting with '/'.
> >>
> >> Is it working as expected (and in this case is there any reason to have
> an
> >> address starting with '/') or it's a bug?
> >>
> >>
> >>
> >> Regards
> >>
> >> Riccardo
> >>
>
>