I have an applet that needs to have a sending socket and a receiving socket, each unidirectional, on ports 2001 and 2002. now, i tried making each one in a thread and it did not work. can someone give me a code example as to how to do this? i am desperate for an answer at this point. thank you muchly

I'm not completely sure you can do this, but if you can, an extra class that extends Thread should work:

Have the normal class make the calls to the thread class:

public class b
{
     public b()
     {
             new ThreadClass(socket,2001);
             new ThreadClass(socket,2002);
     }
}

public class ThreadClass extends Thread
{
       public ThreadClass(Socket socket, int port)
       {
              //do some crap
       }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.