By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,130 Members | 2,100 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,130 IT Pros & Developers. It's quick & easy.

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

P: 11
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(Username, 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
Nov 20 '08 #1
Share this Question
Share on Google+
3 Replies


balabaster
Expert 100+
P: 797
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?
Nov 20 '08 #2

Plater
Expert 5K+
P: 7,872
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?
Nov 20 '08 #3

Frinavale
Expert Mod 5K+
P: 9,731
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
Nov 20 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.