Need to open two concurrent Sockets

Reply

Join Date: Jun 2005
Posts: 3
Reputation: twocentwhoracle is an unknown quantity at this point 
Solved Threads: 0
twocentwhoracle twocentwhoracle is offline Offline
Newbie Poster

Need to open two concurrent Sockets

 
0
  #1
Jun 8th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: Need to open two concurrent Sockets

 
0
  #2
Jun 8th, 2005
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:
  1. public class b
  2. {
  3. public b()
  4. {
  5. new ThreadClass(socket,2001);
  6. new ThreadClass(socket,2002);
  7. }
  8. }
  9.  
  10. public class ThreadClass extends Thread
  11. {
  12. public ThreadClass(Socket socket, int port)
  13. {
  14. //do some crap
  15. }
  16. }
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC