• Post Reply Bookmark Topic Watch Topic
  • New Topic

swt application should listen on multiple ports.

 
Tom Dezo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My swt application on Eclipse platform is not able to listen on multiple ports. Each port is multi threaded. I want the action that I trigger from the UI (Buttons) should be threaded. How to do that?

I have two buttons B1, B2 both will invoke diff ports e.g. B1->port no 5555 and B@-> port no 6666. By pressing B1 things are blocked.

Any solution???

Thanks,
Sumit.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

It sounds like you may be calling ServerSocket.accept() directly in your button's event handler. You can't do that, as it will block the event thread, so no other events will be handled. You must spawn a new Thread, and in the new Thread you can call accept().
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's an example from a running system ... exactly as Ernest described, the accept() is in the HttpServer running on its own thread:

[ June 10, 2005: Message edited by: Stan James ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!