Results 1 to 2 of 2

Thread: Threading and the timer, problem.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2002
    Posts
    26

    Threading and the timer, problem.

    I have created a UDP sockets class. But theres a fundamental flaw in the class.

    When the UDPclient is listening for a reply from the server it hangs my program if no reply is sent. I got over this by running the udpsend in another thread. Great but now I have a thread that needs killing. I thought of using the timer the kill the thread if it didnt repond in the alloted time, but apparently timers only work in a single threaded environment.

    Has anyone got any suggestions of how to get around this problem?

    Strange to think that with VB6 this task was done easily within 5 mins (this is my 3rd day in VB.NET!

    Imogen

    PS before you suggest using a TCP client server with a definite connection state, I cant the server is pre-written and I do not have the source code to authority to change it.

    Also I could use the VB6 OCX to achieve the desired result... but feel I shouldnt have to, should I be able to do it just as well (if not better in .NET)

  2. #2
    Addicted Member
    Join Date
    Mar 2001
    Location
    Devon, UK
    Posts
    181
    Have a look in <FrameworkSDK>\Samples\Technologies\Threading\Timers
    There is a example which may help.
    Wind and waves resolves all problems.

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