Skip to content

Reconnect error: clientId already in use #12

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1. app.eConnect()
2. app.eDisconnect()
3. app.eConnect()

What is the expected output? What do you see instead?
I would expect normal connection again, but instead I see this error message:
errorCode:326
    errorMsg:Unable connect as the client id is already in use. Retry with a unique client id.

What version of the product are you using? On what operating system?
0.7.6-9.51 on Windows XP

Please provide any additional information below.

In the IB Gateway I still see that the client is open after eDisconnect is 
called. The other clients (Excel) disconnect properly. If the Python 
interpreter is restarted, the connection is finally closed. 

I inserted an explicit call to socket shutdown and close in eDisconnect to 
force the connection to be broken.




    @eConnect.register(object, Socket, int)
    @synchronized(mlock)
    def eConnect_0(self, socket, clientId):
        self.ibsocket = socket # will use it in eDisconnect
        self.m_dos = DataOutputStream(socket.getOutputStream())
        ...




    @synchronized(mlock)
    def eDisconnect(self):
        ... # omitted
        try:
            if self.reader is not None:
                self.reader.interrupt()
        except (Exception, ), e:
            pass
        try :
            # close the socket, don't wait till the other handle is freed
            #http://stackoverflow.com/questions/409783/socket-shutdown-vs-socket-close
            self.ibsocket.shutdown(SHUT_RDWR)
            self.ibsocket.close()
        except (Exception, ), e:
            pass 
        try:
            if dos is not None:
                dos.close()
        except (Exception, ), e:
            pass 


Best regards,
Aa`Koshh

Original issue reported on code.google.com by [email protected] on 16 Nov 2011 at 1:03

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions