Results 1 to 12 of 12

Thread: Hmmph Getting a hashtable collection from a dll

  1. #1

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Hmmph Getting a hashtable collection from a dll

    Ok this is killing me. First off this is part of a plugin system I am working on for an app i am re-writting from vb6. What is happening is that I have a dll that contains a hashtable collection that stores class instances of my socket class for each connected user to my main app. Problem is, is I need the data my main app adds to that collection in that dll, accessable from external dll plug-ins. I just cannot get this .Ive tried making the hashtable public shared, but when the plug-in tries to get the hashtable, it always comes out blank.. Basically i need something like GetObject in VB which i used to get a running instance of a dll class. What am I missing?

    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Well if you can't find another way you could remote a single instance, which means that the app and the dll/plugins could access the same hashtable.

    Or can't the app pass the instance its using to the plugins in some sort of OnStart event.

  3. #3

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Yeah, Ive been thinking on that, was just hoping for something that might be straight forward that I was missing.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Here is the non remoting way I was speaking of. Its a bit of a quick version but I'm sure you'll understand.

  5. #5
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Cander, how are you retrieving the objects from the Hashtable?
    Dont gain the world and lose your soul

  6. #6

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Originally posted by Edneeis
    Here is the non remoting way I was speaking of. Its a bit of a quick version but I'm sure you'll understand.
    Still doesnt do it. you should be able to run a second copy of the same exe(with changes to the button names as to not cause a key conflict in the hashtable), and when youy hit test, the messagebox should show 4. It still only shows 2.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    So you don't want to share the applications hashtable instance you want one that is completely independant of the application and shared across multiple exes. I think you have to use remoting for that one sorry. Thats the only way I've found to share across multiple applications or application instances, because it sort of works like an activeX exe used.

  8. #8

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Alrighty. Ive been working on doing with Remoting.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  9. #9

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    yuck. I think I better find another way(hopefully). Using remoting is pretty slow(ok 1-2 seconds may not seem that long, but for what it needs to do, it is), and that is with client and server on same machine..Ill just keep looking. There has got to be a better way.. If anyone see's any other possible ways, let me know.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  10. #10
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Please post back here if you find another way. Also there is a BIG difference in the different channels you use in Remoting and the speed. TCP being MUCH faster than HTTP and both are faster if they use the Binary sink or whatever they call it.

  11. #11
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    This may still be too slow for you, I used TCP but not Binary formatting. I don't know how to set Binary Formatting in code only in a config file and since the same exe doubles as client or server I didn't set up a config file. I also forgot how to set the timeout for the remoting attempts, because that is part of the delay here. It has to check for a server first which then if none is found it acts as the server, but that causes a little delay for the first instance startup.

    Try changing the button caption from a 2nd instance of the app.
    Attached Files Attached Files

  12. #12

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    I did use TCP. :/

    I have a few ideas I am going to explore with today. Ill post details if i get anything working well.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

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



Click Here to Expand Forum to Full Width