I'm creating a simple chat program using sockets... I did the program using a console and it worked in console so the next thing I did is to make a graphical user interface but whenever the program reaches the code serverSocket.accept(), the GUI just hangs and I can't do anything.. do I have to run the graphical user interface and sockets on different threads?
it2051229
-3
Junior Poster in Training
Recommended Answers
Jump to PostBecause accept blocks until it gets a connection attempt. You should be placing your network (and all other operational code) into a different thread from your GUI code, because when you attempt to perform an operation on the Event thread, the GUI will not respond until that operation is finished. …
All 2 Replies
masijade
1,351
Industrious Poster
Team Colleague
Featured Poster
it2051229
-3
Junior Poster in Training
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.