• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multithreaded Server App (Gui)

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey. Guys. Anyone that can Paste Coding On the following for me, because I have been Stuck on this section for 4weeks now. I just ask for Help on Creating a small gui. What should happen is JButton "Start Server" to be able to start an application server which will service multiple clients through a thread/threads. Thank you in advance. I have to finish this project by wednesday. Thanks again.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So this is a desktop Swing application? If so, what are the "multiple clients" - from where are they connecting through sockets?

I'm not sure where exactly the problem is from your description; if it's in creating a GUI containing a JButton you may want to read up on Swing GUis in general: http://java.sun.com/docs/books/tutorial/uiswing/index.html
If it's in the multi-threaded client/server socket communication, see http://java.sun.com/docs/books/tutorial/networking/sockets/index.html

As an aside, JavaRanch is NotACodeMill, so no one here is going to write the code for you. But we're happy to help if you tell us what you have so far, and where you're stuck making progress.
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doing what you describe is fairly simple for me anyway. The Swing tutorial is a good start getting the JButton to work.

But the thing is so what if you press the button and start the server? Is there a client app to connect to the server? Another thing why need a button to start/stop server? Or why need a GUI for the server?
 
Thabo Matjuda
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey. thank you. Let me elaborate more. Yes it's a desktop Application. Clients are supppoced to be connected through sockets. And secondly where am I stuck? I am stuck with the button. When i code the server intialisation in the eventhandler, everything runs smooth. The problem is when I add the accepting() block, because my server application then freezes, but still lets the clients in.
 
K. Tsang
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thabo Matjuda wrote:The problem is when I add the accepting() block, because my server application then freezes, but still lets the clients in.



Then you better post what you have already in the accepting() block so we can help.
 
Thabo Matjuda
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay I need a button/gui because those are my project specifications. Yes i have a client to connect to the server. I hope I have answered your questions DITMMER. Thank you.
 
Thabo Matjuda
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay I will post it here.
 
Thabo Matjuda
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Guys. Thanks. I believe I have fixed the Freezing Server problem. The thing is, my accept(block), had to be in a thread. Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic