Thats the thing...if I exit it, then there won't be a way to check for incoming messages. What if the admin wants to cancel the previous command (.e. to exit the application). The while true must be active always, you know. Isnt it possible to have a timer or other function for that matter to work while the while loop contines as well?
I tired the code below which avoids calling timer or so but after first message has arrived, the boolean check at the bottom dont increase the value of inttime variable.
Sorry for my english...
-
Try
-
-
While True
-
Me.Text = (blnautocloseapp) & " " & TimeOfDay
-
-
Dim clientListener As New TcpListener(ipAddress, 8505)
-
clientListener.Start()
-
mySocket = clientListener.AcceptSocket()
-
mySocket.Receive(recieveBuff, recieveBuff.Length, SocketFlags.None)
-
str = System.Text.Encoding.ASCII.GetString(recieveBuff, 0, recieveBuff.Length).Trim(Microsoft.VisualBasic.ChrW(0))
-
If str <> "" Then
-
str = understandSentMessage(str)
-
NotifyIcon1.Text = "DoubleS Library Manager Notification Window"
-
NotifyIcon1.ShowBalloonTip(1000, "DoubleS Library Manager: Administrator Message", str, ToolTipIcon.Info)
-
'close app or what?
-
-
If blnautocloseapp = False Then 'auto end program.
-
-
inttime = 0
-
End If
-
End If
-
-
mySocket.Close()
-
mySocket.Dispose()
-
-
-
-
-
clientListener.Stop()
-
-
If blnautocloseapp = True Then
-
-
inttime = inttime + 1
-
MsgBox(inttime)
-
If inttime = 2 Then
-
MsgBox("Good bye!")
-
End
-
End If
-
-
End If
-
End While
-
-
-
-
-
-
-
Catch ex As Exception
-
MsgBox(ex.Message)
-
-
End Try
-