Server-Clients, Threads, Reflection, Processes and Everything Else

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • frogga
    New Member
    • May 2008
    • 11

    Server-Clients, Threads, Reflection, Processes and Everything Else

    Hi All

    I've got a real puzzler that I just can't seem to get my head around. Basically I'm writing a server-client using a third party dll to access their database. The third party library requires a login using a static method before any of the other methods can be used:

    tpdll.Login(Use rname, Password); *

    * The username and password will always be the same in my app

    When a client connects to my server app it fires a new thread and calls this login. If there is only 1 client connecting at a time its fine. If one client connects and then a second client connects while the first is still logged into the third party dll the first client is disconnected from using the dll.

    I've tried 2 completely seperate applications that log into the third party dll using the same logins and run them parallel and they worked fine so I know the third party app allows the same user to be logged in twice. So is this a problem with the threads using the same login at the same time? If so is there anyway to load the dlls seperately for each thread?

    I'm using c# .net 2.0
  • balabaster
    Recognized Expert Contributor
    • Mar 2007
    • 798

    #2
    Sounds like a bug in their dll... have you tried contacting them? It seems to me that if it's a static method then it should be written such that it is threadsafe. Does the method return a value?

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      I would say what is happening is you have created what is really a single instance of the object, that is being shared over the webapplication (application only loads the dll once after all)
      And you are trying to use it as if it were being loaded each time?

      Try pretending like every user on the web application is the same and coding for that way (you might have to put in some lock(){} calls to prevent race conditions) and see if that stops one person being shut out by the other?

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Originally posted by Plater
        I would say what is happening is you have created what is really a single instance of the object, that is being shared over the webapplication (application only loads the dll once after all)
        And you are trying to use it as if it were being loaded each time?

        Try pretending like every user on the web application is the same and coding for that way (you might have to put in some lock(){} calls to prevent race conditions) and see if that stops one person being shut out by the other?

        I think Plater's on to something here.

        I did that once.

        I was half following a tutorial when creating a DLL that handles database interactions... . the tutorial declared a shared database connection and I wasn't paying attention to the "Shared" keyword...

        When I used it in a multi-threaded application and tried I ran into some pretty crazy problems with the DLL. Much like you are describing here.

        -Frinny

        Comment

        Working...