|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
tcpListener.AcceptSocket strange behaviorI have an application running on all pc's in our company. Basically it is a TCPListener awaiting for sockets to connect and on connection performs the required tasks. The app works fine, but while the listener is awaiting for socket to connect several other applications can't start, and even installation of new applications migth hang. In order to finalise the other apps or installations the tcp listener is killed resulting in the other apps and installs to complete. A scannig of ports indicates that the port used (2000) is free. The application has two threeads. The listener thread described above and an other thread for managing user interaction using the systray. The listener thread has initially loaded a form, which is hidden while waiting for new sockets to connect. Here is a some of the code: Dim ip As IPAddress ip = IPAddress.Any tcplistener = New TcpListener(ip, myPort) tcpListener.Start() While True Dim socket As Socket = tcpListener.AcceptSocket() Any suggestions will be appriciatd. Bjørn Bjorn,
You can let your code run in a timerevent or you can let your thread sleep in the loop. \\\\ threading.thread.sleep(milliseconds) //// Now you are probably eating all your processor activitates in the loop. I hope this helps, Cor "Bjørn Eliasen" <s*@amcom.dk> schreef in bericht news:ueNcQtUvGHA.4756@TK2MSFTNGP04.phx.gbl... I have an application running on all pc's in our company. Basically it is a TCPListener awaiting for sockets to connect and on connection performs the required tasks. The app works fine, but while the listener is awaiting for socket to connect several other applications can't start, and even installation of new applications migth hang. In order to finalise the other apps or installations the tcp listener is killed resulting in the other apps and installs to complete.Hi, A scannig of ports indicates that the port used (2000) is free. The application has two threeads. The listener thread described above and an other thread for managing user interaction using the systray. The listener thread has initially loaded a form, which is hidden while waiting for new sockets to connect. Here is a some of the code: Dim ip As IPAddress ip = IPAddress.Any tcplistener = New TcpListener(ip, myPort) tcpListener.Start() While True Dim socket As Socket = tcpListener.AcceptSocket() Any suggestions will be appriciatd. Bjørn Thanks for the suggestion,
It is only a few specific programs which fails and the cpu is not busy at all. As I understand I have to wait for a socket to connect constantly otherwise I migth fail to get a connection? The line "Dim socket As Socket = tcpListener.AcceptSocket()" is just awaiting a new socket to connect and I can't really se how I can code any sleep functionality into this. Bjørn "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> skrev i en meddelelse news:u2ukGCVvGHA.4384@TK2MSFTNGP04.phx.gbl... You can let your code run in a timerevent or you can let your thread sleep in the loop.Bjorn, \\\\ threading.thread.sleep(milliseconds) //// Now you are probably eating all your processor activitates in the loop. I hope this helps, Cor "Bjørn Eliasen" <s*@amcom.dk> schreef in bericht news:ueNcQtUvGHA.4756@TK2MSFTNGP04.phx.gbl... Hi,I have an application running on all pc's in our company. Basically it is a TCPListener awaiting for sockets to connect and on connection performs the required tasks. The app works fine, but while the listener is awaiting for socket to connect several other applications can't start, and even installation of new applications migth hang. In order to finalise the other apps or installations the tcp listener is killed resulting in the other apps and installs to complete. A scannig of ports indicates that the port used (2000) is free. The application has two threeads. The listener thread described above and an other thread for managing user interaction using the systray. The listener thread has initially loaded a form, which is hidden while waiting for new sockets to connect. Here is a some of the code: Dim ip As IPAddress ip = IPAddress.Any tcplistener = New TcpListener(ip, myPort) tcpListener.Start() While True Dim socket As Socket = tcpListener.AcceptSocket() Any suggestions will be appriciatd. Bjørn Side talk:
Just wondering how can your client socket detect connection dropped by your server socket? (ie., when your tcpListener socket dropped, how can the other side of your tcpClient socket know about it?) Show quoteHide quote "Bjørn Eliasen" wrote: > Thanks for the suggestion, > > It is only a few specific programs which fails and the cpu is not busy at all. As I understand I have to wait for a socket to connect constantly otherwise I migth fail to get a connection? > > The line "Dim socket As Socket = tcpListener.AcceptSocket()" is just awaiting a new socket to connect and I can't really se how I can code any sleep functionality into this. > > Bjørn > > > > > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> skrev i en meddelelse news:u2ukGCVvGHA.4384@TK2MSFTNGP04.phx.gbl... > Bjorn, > > You can let your code run in a timerevent or you can let your thread sleep in the loop. > \\\\ > threading.thread.sleep(milliseconds) > //// > > Now you are probably eating all your processor activitates in the loop. > > I hope this helps, > > > Cor > "Bjørn Eliasen" <s*@amcom.dk> schreef in bericht news:ueNcQtUvGHA.4756@TK2MSFTNGP04.phx.gbl... > Hi, > > I have an application running on all pc's in our company. Basically it is a TCPListener awaiting for sockets to connect and on connection performs the required tasks. The app works fine, but while the listener is awaiting for socket to connect several other applications can't start, and even installation of new applications migth hang. In order to finalise the other apps or installations the tcp listener is killed resulting in the other apps and installs to complete. > > A scannig of ports indicates that the port used (2000) is free. > > The application has two threeads. The listener thread described above and an other thread for managing user interaction using the systray. The listener thread has initially loaded a form, which is hidden while waiting for new sockets to connect. > > Here is a some of the code: > > Dim ip As IPAddress > ip = IPAddress.Any > tcplistener = New TcpListener(ip, myPort) > tcpListener.Start() > While True > Dim socket As Socket = tcpListener.AcceptSocket() > > Any suggestions will be appriciatd. > > Bjørn
Can a .NET Web Service be accessed from a VB6 Client?
Is there a statement that will completely empty a listbox? Event handlers DataGridView Column Alignment Trouble with pixels Quesion about ADO.NET in VB.NET Threading Question How to code image path relative to project Tip of The Day is My.Settings version specific? |
|||||||||||||||||||||||