Results 1 to 6 of 6

Thread: Sockets...and i do mean more than 1 at a time...

  1. #1

    Thread Starter
    Addicted Member theonetrueace's Avatar
    Join Date
    Jan 2002
    Location
    South Alabama
    Posts
    196

    Sockets...and i do mean more than 1 at a time...

    heres wut i've been trying to do for the longest time....searched the internet over....search here countless as well....anyway heres what i want to do....

    create a new socket....dynamicly....give it a name or index....so i can send it commands....and set it up so that it will return events such as connection and such....

    basicly i want to set it up like an array....creating a bunch of sockets in one sub.....then giving them commands from another sub....

    most of what i can found on the internet gives me an example of creating the socket....connecting...sending and recieving data...and closing, all in one sub.....but i really need to make the control public....

    main thing im looking for here is to be able to create an array to connect to a certin amount of remotehosts which is determined at runtime.....

    see wut im saying?

    AcE

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Lookup some imformation on HashTable collections. I dont hve any examples available currently(on my other computer and it is dead currently). But you store each instance of a connected client class into the collection.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Addicted Member theonetrueace's Avatar
    Join Date
    Jan 2002
    Location
    South Alabama
    Posts
    196
    kewl....wuz kindof thinking they had to be put into some type of collection.....would love a example of a hashtable....but i'll check around....thx

    AcE

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    some example:
    http://www.devasp.net/net/articles/article.aspx?ID=44

    They are just adding strings, but remember, strings are objects too so it is the same thing really.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    Addicted Member theonetrueace's Avatar
    Join Date
    Jan 2002
    Location
    South Alabama
    Posts
    196
    well im at work now.....but i'll check this out tonight....but ... how would it throw events?....i mean...lets say for examplei got 10 sockets in that collection....how do i say, when you throw the datarecieved event....do this....

    AcE

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    The same way you intercept any other event. You use AddHandler
    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