Results 1 to 2 of 2

Thread: Socket binding problem

  1. #1
    Xlinthisias is offline Registered User
    Join Date
    Feb 2006
    Posts
    5

    Socket binding problem

    Hi,

    I've encountered two small problems. Both problems came out in java implementation of Ice. The first one appeared when I've written unit test for the server I began to implement. I wrote sequence of unit tests, which every one was builed like this:

    --========= Initialization part
    server initialization
    client initialization

    test some functionality

    --========= Release part
    client deinitialization
    server deinitialization

    For both - server and client I used shutdown and destroy methods. For server I used also deactivate adapter created by me. First unit test passed without any problems, problems appeared when began second unit test. The initialization of the server failed, because of the socket was still binded to the interface. The problem encountered on the windows XP platform, I used JDK 5.0. Below I put the stack trace, printed by the second unit test

    [ Network: attempting to bind to tcp socket 127.0.0.1:5555 ]
    Ice.SyscallException
    error = 0
    at IceInternal.IncomingConnectionFactory.<init>(Incom ingConnectionFactory.java:460)
    at Ice.ObjectAdapterI.<init>(ObjectAdapterI.java:829)
    at IceInternal.ObjectAdapterFactory.createObjectAdapt er(ObjectAdapterFactory.java:130)
    at Ice.CommunicatorI.createObjectAdapterWithEndpoints (CommunicatorI.java:53)
    at Ice.CommunicatorI.createObjectAdapter(Communicator I.java:47)
    at dist.dj.server.RequestListener.run(RequestListener .java:37)
    at dist.dj.util.pool.ThreadPool$PooledThread.run(Thre adPool.java:63)
    Caused by: Ice.SocketException
    error = 0
    at IceInternal.Network.doBind(Network.java:211)
    at IceInternal.TcpAcceptor.<init>(TcpAcceptor.java:12 8)
    at IceInternal.TcpEndpointI.acceptor(TcpEndpointI.jav a:369)
    at IceInternal.IncomingConnectionFactory.<init>(Incom ingConnectionFactory.java:409)
    ... 6 more
    Caused by: java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind(Native Method)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSock etChannelImpl.java:119)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAd aptor.java:59)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAd aptor.java:52)
    at IceInternal.Network.doBind(Network.java:205)
    ... 9 more

    The second problem is the content of an exception class generated by the slice2java tool. It's small but annoying :] It generates warning in the Eclipse IDE. Below I put an example of part of method.


    public class ClientNotLogged extends Ice.UserException
    {
    [...]
    public void
    __read(IceInternal.BasicStream __is, boolean __rid)
    {
    if(__rid)
    {
    String myId = __is.readString(); <-- I suppose, that is for skipping part of the data packet
    }
    __is.startReadSlice();
    message = __is.readString();
    __is.endReadSlice();
    }

    [...]
    }
    Artur Krysiak
    www.bms.com.pl
    tests against Corba, Ice, WebServices and java RMI

  2. #2
    marc's Avatar
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,860
    For the first problem, when a socket is closed, the port number is not always immediately released by the operating system. That's why you get the "Address already in use" exception. If you investigate the socket, you will see that it is in TIME_WAIT state. For more information on this, see the last paragraph of this FAQ.

    We will look into the second problem. Thanks for reporting this.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Indirect Binding
    By Jennie in forum Help Center
    Replies: 5
    Last Post: 10-19-2011, 03:00 PM
  2. Socket operation on non-socket local address
    By Oleh Babyak in forum Bug Reports
    Replies: 1
    Last Post: 04-03-2009, 10:12 AM
  3. About Direct Binding and Indirect Binding
    By eyexercise in forum Help Center
    Replies: 0
    Last Post: 12-02-2004, 02:57 AM
  4. C# binding, when?
    By shantanu_k06 in forum Comments
    Replies: 1
    Last Post: 12-22-2003, 03:14 PM
  5. C# binding
    By Claes in forum Comments
    Replies: 2
    Last Post: 10-20-2003, 04:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •