java timer and socket problem

后端 未结 3 1226
再見小時候
再見小時候 2020-12-21 11:28

I\'m trying to make a program which listens to the client input stream by using socket programming and timer

but whenever timer executes.. it gets hanged

Ple

3条回答
  •  囚心锁ツ
    2020-12-21 11:56

    Make the program multi-threaded; one thread listens on the socket, the other one handles the GUI. Use SwingUtilities.invokeLater to let the GUI thread ("event dispatching thread") do the GUI updates whenever the network thread receives data.

提交回复
热议问题