server-application

Using TcpListener.AcceptSocket(); in a separate thread causes the thread to block?

萝らか妹 提交于 2019-12-02 04:27:24
问题 I have tried to work around this as well as debug but I'm at a loose end here :( is there any alternative to using this to check for a client connection? This code works fine in a console application so i am guessing the thread is being blocked, although it may be something else i can't see? public partial class Form1 : Form { Socket s; Declatation of socket. private void startButton_Click(object sender, EventArgs e) { checkTimer.Enabled = true; if (bw.IsBusy != true) { bw.RunWorkerAsync(); }

Using TcpListener.AcceptSocket(); in a separate thread causes the thread to block?

若如初见. 提交于 2019-12-02 01:29:57
I have tried to work around this as well as debug but I'm at a loose end here :( is there any alternative to using this to check for a client connection? This code works fine in a console application so i am guessing the thread is being blocked, although it may be something else i can't see? public partial class Form1 : Form { Socket s; Declatation of socket. private void startButton_Click(object sender, EventArgs e) { checkTimer.Enabled = true; if (bw.IsBusy != true) { bw.RunWorkerAsync(); } } Background thread to start on button press. private void bw_DoWork(object sender, DoWorkEventArgs e)

How can I write a Java application that can update itself at runtime?

大兔子大兔子 提交于 2019-11-26 02:17:01
问题 I would like to implement a java application (server application) that can download a new version (.jar file) from a given url, and then update itself at runtime. What is the best way to do this and is it possible? I guess that the application can download a new .jar file and start it. But how should I do the handover, e.g. know when the new application is started and then exit. Or is there a better way to do this? 回答1: The basic structure of a solution is as follows: There is a main loop