You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Michael Newcomb (JIRA)" <ji...@apache.org> on 2006/09/16 03:32:22 UTC

[jira] Created: (DIRMINA-266) SocketAcceptor.bind() requires address != null and port != 0... why? Also can get to ServerSocketChannel.socket().getLocalSocketAddress()

SocketAcceptor.bind() requires address != null and port != 0... why? Also can get to ServerSocketChannel.socket().getLocalSocketAddress()
-----------------------------------------------------------------------------------------------------------------------------------------

                 Key: DIRMINA-266
                 URL: http://issues.apache.org/jira/browse/DIRMINA-266
             Project: Directory MINA
          Issue Type: Bug
    Affects Versions: 0.9.5
            Reporter: Michael Newcomb


public void bind( SocketAddress address, IoHandler handler, IoServiceConfig config ) throws IOException
{
  // if( address == null )
  // {
  //     throw new NullPointerException( "address" );
  // }

  if( handler == null )
  {
      throw new NullPointerException( "handler" );
  }

  if( address != null &&  !( address instanceof InetSocketAddress ) )
  {
      throw new IllegalArgumentException( "Unexpected address type: " + address.getClass() );
  }

  // if( ( ( InetSocketAddress ) address ).getPort() == 0 )
  // {
  //     throw new IllegalArgumentException( "Unsupported port number: 0" );
  // }

 ...

Also, you need to fix the physical binding and registration in the channels map:


// and bind.
ssc.socket().bind( req.address, cfg.getBacklog() );

// assign what was actually bound
//
req.address = ssc.socket().getLocalSocketAddress();

ssc.register( selector, SelectionKey.OP_ACCEPT, req );


I am by no means a networking genius, but is there a reason why this type of use is not allowed?

Also, if assigning the SocketAddress at bind is used, there needs to be a way for you to get the local socket address from the IoSession api.

Thanks,
Michael

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (DIRMINA-266) SocketAcceptor.bind() requires address != null and port != 0... why? Also can get to ServerSocketChannel.socket().getLocalSocketAddress()

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Trustin Lee updated DIRMINA-266:
--------------------------------

    Fix Version/s:     (was: 1.1)

> SocketAcceptor.bind() requires address != null and port != 0... why? Also can get to ServerSocketChannel.socket().getLocalSocketAddress()
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-266
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-266
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 0.9.5
>            Reporter: Michael Newcomb
>         Assigned To: Trustin Lee
>             Fix For: 1.0.1
>
>
> public void bind( SocketAddress address, IoHandler handler, IoServiceConfig config ) throws IOException
> {
>   // if( address == null )
>   // {
>   //     throw new NullPointerException( "address" );
>   // }
>   if( handler == null )
>   {
>       throw new NullPointerException( "handler" );
>   }
>   if( address != null &&  !( address instanceof InetSocketAddress ) )
>   {
>       throw new IllegalArgumentException( "Unexpected address type: " + address.getClass() );
>   }
>   // if( ( ( InetSocketAddress ) address ).getPort() == 0 )
>   // {
>   //     throw new IllegalArgumentException( "Unsupported port number: 0" );
>   // }
>  ...
> Also, you need to fix the physical binding and registration in the channels map:
> // and bind.
> ssc.socket().bind( req.address, cfg.getBacklog() );
> // assign what was actually bound
> //
> req.address = ssc.socket().getLocalSocketAddress();
> ssc.register( selector, SelectionKey.OP_ACCEPT, req );
> I am by no means a networking genius, but is there a reason why this type of use is not allowed?
> Also, if assigning the SocketAddress at bind is used, there needs to be a way for you to get the local socket address from the IoSession api.
> Thanks,
> Michael

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (DIRMINA-266) SocketAcceptor.bind() requires address != null and port != 0... why? Also can get to ServerSocketChannel.socket().getLocalSocketAddress()

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRMINA-266?page=all ]

Trustin Lee resolved DIRMINA-266.
---------------------------------

    Fix Version/s: 1.0.1
                   1.1
       Resolution: Fixed
         Assignee: Trustin Lee

Done.  The fix has been applied to 1.0.1 and 1.1.  Please close this issue if you find this bug is gone.

> SocketAcceptor.bind() requires address != null and port != 0... why? Also can get to ServerSocketChannel.socket().getLocalSocketAddress()
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-266
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-266
>             Project: Directory MINA
>          Issue Type: Bug
>    Affects Versions: 0.9.5
>            Reporter: Michael Newcomb
>         Assigned To: Trustin Lee
>             Fix For: 1.0.1, 1.1
>
>
> public void bind( SocketAddress address, IoHandler handler, IoServiceConfig config ) throws IOException
> {
>   // if( address == null )
>   // {
>   //     throw new NullPointerException( "address" );
>   // }
>   if( handler == null )
>   {
>       throw new NullPointerException( "handler" );
>   }
>   if( address != null &&  !( address instanceof InetSocketAddress ) )
>   {
>       throw new IllegalArgumentException( "Unexpected address type: " + address.getClass() );
>   }
>   // if( ( ( InetSocketAddress ) address ).getPort() == 0 )
>   // {
>   //     throw new IllegalArgumentException( "Unsupported port number: 0" );
>   // }
>  ...
> Also, you need to fix the physical binding and registration in the channels map:
> // and bind.
> ssc.socket().bind( req.address, cfg.getBacklog() );
> // assign what was actually bound
> //
> req.address = ssc.socket().getLocalSocketAddress();
> ssc.register( selector, SelectionKey.OP_ACCEPT, req );
> I am by no means a networking genius, but is there a reason why this type of use is not allowed?
> Also, if assigning the SocketAddress at bind is used, there needs to be a way for you to get the local socket address from the IoSession api.
> Thanks,
> Michael

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (DIRMINA-266) SocketAcceptor.bind() requires address != null and port != 0... why? Also can get to ServerSocketChannel.socket().getLocalSocketAddress()

Posted by "Michael Newcomb (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DIRMINA-266?page=comments#action_12435166 ] 
            
Michael Newcomb commented on DIRMINA-266:
-----------------------------------------

That should be "can't get to ServerSocketChannel.socket().getLocalSocketAddress()" not 'can get to...'


> SocketAcceptor.bind() requires address != null and port != 0... why? Also can get to ServerSocketChannel.socket().getLocalSocketAddress()
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-266
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-266
>             Project: Directory MINA
>          Issue Type: Bug
>    Affects Versions: 0.9.5
>            Reporter: Michael Newcomb
>
> public void bind( SocketAddress address, IoHandler handler, IoServiceConfig config ) throws IOException
> {
>   // if( address == null )
>   // {
>   //     throw new NullPointerException( "address" );
>   // }
>   if( handler == null )
>   {
>       throw new NullPointerException( "handler" );
>   }
>   if( address != null &&  !( address instanceof InetSocketAddress ) )
>   {
>       throw new IllegalArgumentException( "Unexpected address type: " + address.getClass() );
>   }
>   // if( ( ( InetSocketAddress ) address ).getPort() == 0 )
>   // {
>   //     throw new IllegalArgumentException( "Unsupported port number: 0" );
>   // }
>  ...
> Also, you need to fix the physical binding and registration in the channels map:
> // and bind.
> ssc.socket().bind( req.address, cfg.getBacklog() );
> // assign what was actually bound
> //
> req.address = ssc.socket().getLocalSocketAddress();
> ssc.register( selector, SelectionKey.OP_ACCEPT, req );
> I am by no means a networking genius, but is there a reason why this type of use is not allowed?
> Also, if assigning the SocketAddress at bind is used, there needs to be a way for you to get the local socket address from the IoSession api.
> Thanks,
> Michael

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira