did you try a simple non-MINA server and see what it returns? If it is 0,
then there must be something going on with Java on linux.
BTW, what JDK are you using?
On Nov 28, 2007 12:45 AM, Michael Grundvig <[EMAIL PROTECTED]> wrote:
> Hi all; this might or might not be a MINA issue, but we see it in our MINA
> app and it's network related so I think I can get away with posting it here.
>
> Inside of the SessionOpened event of our IOHandlerAdapter, we need to get
> the port number the client used to connect to the server. So if the server
> is listening on port 1234, we need the port integer in the code below to be
> 1234. This seems simple enough and both code snippets below work perfectly
> on Windows and OSX, but for some reason on CentOS both snippets give us a
> port of 0.
>
> SocketAddress address = ioSession.getLocalAddress();
> InetSocketAddress inetAddress = (InetSocketAddress) address;
> int port = inetAddress.getPort();
>
>
> SocketAddress address = ioSession.getServiceAddress();
> InetSocketAddress inetAddress = (InetSocketAddress) address;
> int port = inetAddress.getPort();
>
> Why would both of these return 0 and only on Linux? Is there another way
> to accomplish this? As the server can be listening on many ip/ports at once,
> I can't seem to find a convenient work around. Any help would be greatly
> appreciated!
>
> Thanks!
>
> Mike
>
--
--------------------------------
The adjuration to be "normal" seems shockingly repellent to me; I see
neither hope nor comfort in sinking to that low level. I think it is
ignorance that makes people think of abnormality only with horror and allows
them to remain undismayed at the proximity of "normal" to average and
mediocre. For surely anyone who achieves anything is, essentially, abnormal.
Dr. Karl Menninger