Results 1 to 3 of 3

Thread: multithreading

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    5

    multithreading

    Hi, done a search on multithreading and became a bit wiser, but not as wise as I was hoping for


    In this program I'm writing I've got 2 "almost" infinite loops (until I say STOP that is) that need to be run all the time. It's socket testing ...

    So the first thread contains a server listening process. I'm trying to get a multi-user server ready. Therefor I need to constantly "listen" -> thread must be kept alive

    Once a client is connected, the first loop creates a new thread. This thread is the socket receive code. This is also an "infinite" loop (until a certain command) because a client can type anything at any moment.

    The second thread is being executed but seems to stop almost immediately to continue on running the first thread...

    Now, I was thinking ... isn't there a way to switch threads every now and then...
    so :
    --- thread 1
    --- thread 2
    --- thread 1
    --- thread 2

    ....

    Any ideas and solutions are welcome !
    Vamp

  2. #2
    Junior Member
    Join Date
    Apr 2004
    Posts
    19
    look at the threading class. you can spawn separate threads and you can use Delegates to interact between them. I think the Namespace is System.Threading
    www.mod2software.com
    Home of the VB.NET Class Builder Utility - Demo and Full versions available now!

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    5
    yeah, that's what I'm doing at the moment

    ThrServer = new threading.thread(addressof me.startServer)
    ThrServer.start()

    and also a ThrReceive.

    But it seems that the focus is always goes back to ThrServer in stead of constantly switching between the 2 threads ...

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