Click here to Skip to main content
15,909,829 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: is ado.net really disconnected? Pin
PIEBALDconsult12-Sep-10 16:36
mvePIEBALDconsult12-Sep-10 16:36 
QuestionI created org chart using trial version, it is running only in localhost. If i want to run IIS it is giving message like u have to purchase and i am not able to view that chart. Is there any alternation solution to view that chart and run in Server [ Pin
sr1599-Sep-10 1:00
sr1599-Sep-10 1:00 
AnswerRe: I created org chart using trial version, it is running only in localhost. If i want to run IIS it is giving message like u have to purchase and i am not able to view that chart. Is there any alternation solution to view that chart and run in Serv Pin
fjdiewornncalwe9-Sep-10 1:22
professionalfjdiewornncalwe9-Sep-10 1:22 
AnswerRe: I created org chart using trial version, it is running only in localhost. If i want to run IIS it is giving message like u have to purchase and i am not able to view that chart. Is there any alternation solution to view that chart and run in Serv Pin
Pete O'Hanlon9-Sep-10 1:38
mvePete O'Hanlon9-Sep-10 1:38 
AnswerRe: I created org chart using trial version, it is running only in localhost. If i want to run IIS it is giving message like u have to purchase and i am not able to view that chart. Is there any alternation solution to view that chart and run in Serv Pin
Dave Kreskowiak9-Sep-10 3:51
mveDave Kreskowiak9-Sep-10 3:51 
GeneralRe: I created org chart using trial version, it is running only in localhost. If i want to run IIS it is giving message like u have to purchase and i am not able to view that chart. Is there any alternation solution to view that chart and run in Serv Pin
fjdiewornncalwe9-Sep-10 7:29
professionalfjdiewornncalwe9-Sep-10 7:29 
GeneralRe: I created org chart using trial version, it is running only in localhost... Pin
Kunal Chowdhury «IN»10-Sep-10 17:12
professionalKunal Chowdhury «IN»10-Sep-10 17:12 
QuestionOdd problem with UDPClient [modified] - Solved Pin
Peter R. Fletcher8-Sep-10 9:17
Peter R. Fletcher8-Sep-10 9:17 
This is my third attempt to leave this question. The first time I submitted (without keeping a copy of the text - Grrr!) the submission apparently failed and I was left staring at a white screen. The second time was similar, though I did keep a copy.

I am writing a Class to monitor and manage a WiFi-enabled HVAC thermostat which communicates using UDP packets. It sends out a "status report" containing various data every 10 seconds, which I am able to receive (using an asynchronous thread) and decode with no difficulty. Because the thermostat and its WiFi module are relatively slow and single-threaded, I have set the Class up so that settings changes are processed in its main thread and the resulting commands are sent out synchronously from the receiving thread after the status report is received and processed. This is where I have run into som problems.

It appears that if I do not insert pauses (using Thread.Sleep) before and/or between using .Send to transmit each command packet, some packets do not get transmitted (confirmed by using a packet sniffer on the network). In addition, the first packet of at least some combinations of commands appears not to be sent if I do not include an Application.DoEvents call before the pause that precedes it. Putting in breakpoints and/or stepping through the Class code abolishes all misbehavior! This worries me a) because I don't like behavior I don't understand, and b) because I had planned to make the Class into a Class Library, which appears to preclude the use of Application Methods.

The current version of the code is as shown below. Does anyone have any ideas as to what may be going on?

Private Sub ReceiveMessages()
        Try
            Dim receiveBytes As [Byte]() = TCudpClient.Receive(RecEndpoint)
        ' Some error checking code omitted
            Process_Heartbeat(receiveBytes)

            If NewSettings Then ' There are some queued commands
                UpDating = True ' Set a flag to prevent new commands being added while we are processing existing ones
                Send_Commands() ' See below
                UpDating = False
                NewSettings = False
            End If
            ThreadReceive = New System.Threading.Thread(AddressOf ReceiveMessages)
            ThreadReceive.Start()
        Catch ex As System.Threading.ThreadAbortException
            ' this generally means that the thread was deliberately aborted, so we can ignore it
        Catch e As Exception
            If Not ShuttingDown Then Throw New ApplicationException("Problem receiving data from Thermostat" & vbCrLf, e)
        End Try
    End Sub

    Private Sub Send_Commands()
        Static blInitDone As Boolean
        If Not blInitDone Then
            TCudpClient.Connect(IPAddress.Parse(IPText), COMMANDPORT) ' presumably only need to do this once
            'It appears that the first message sent after the Connect command sometimes fails to be transmitted,
            'so we make sure that it gets sent twice
            For Each tc In ThermostatCommands ' find the first available command
               If tc.Pending Then
                    Application.DoEvents()
                    System.Threading.Thread.Sleep(100)
                    SendMessage(tc.ComBuff) ' See below
                    Exit For
                End If
            Next
            blInitDone = True
        Else
        End If

        For Each tc In ThermostatCommands
            If tc.Pending Then
                Application.DoEvents()
                System.Threading.Thread.Sleep(100)
                SendMessage(tc.ComBuff) ' See below
                tc.ComBuff = Nothing
                tc.Pending = False
            End If
        Next
    End Sub

    Private Sub SendMessage(ByVal bytArray() As Byte)
        Dim intReturn As Integer
        intReturn = TCudpClient.Send(bytArray, bytArray.Length)
        If intReturn <> bytArray.Length Then
            Throw New ApplicationException("Problem sending command to Thermostat")
        End If
    End Sub


modified on Thursday, September 9, 2010 4:47 PM

AnswerRe: Odd problem with UDPClient Pin
Luc Pattyn8-Sep-10 9:32
sitebuilderLuc Pattyn8-Sep-10 9:32 
GeneralRe: Odd problem with UDPClient Pin
Peter R. Fletcher8-Sep-10 10:20
Peter R. Fletcher8-Sep-10 10:20 
GeneralRe: Odd problem with UDPClient Pin
Luc Pattyn8-Sep-10 10:53
sitebuilderLuc Pattyn8-Sep-10 10:53 
GeneralRe: Odd problem with UDPClient Pin
Peter R. Fletcher9-Sep-10 10:44
Peter R. Fletcher9-Sep-10 10:44 
GeneralRe: Odd problem with UDPClient Pin
Luc Pattyn9-Sep-10 10:59
sitebuilderLuc Pattyn9-Sep-10 10:59 
GeneralRe: Odd problem with UDPClient Pin
Peter R. Fletcher13-Sep-10 4:51
Peter R. Fletcher13-Sep-10 4:51 
QuestionAdding different contorl( combox, textbox) in a single coloumn of datagirdview (window) Pin
shahabsuhail7-Sep-10 22:56
shahabsuhail7-Sep-10 22:56 
AnswerRe: Adding different contorl( combox, textbox) in a single coloumn of datagirdview (window) Pin
Dave Kreskowiak8-Sep-10 4:18
mveDave Kreskowiak8-Sep-10 4:18 
Questionapplication path Pin
Jefry boycot7-Sep-10 4:59
Jefry boycot7-Sep-10 4:59 
AnswerRe: application path Pin
The Man from U.N.C.L.E.7-Sep-10 6:34
The Man from U.N.C.L.E.7-Sep-10 6:34 
AnswerRe: application path Pin
RaviRanjanKr15-Dec-10 5:25
professionalRaviRanjanKr15-Dec-10 5:25 
QuestionHow does Application.DoEvents work? Pin
MicroVirus7-Sep-10 2:44
MicroVirus7-Sep-10 2:44 
AnswerRe: How does Application.DoEvents work? Pin
Luc Pattyn7-Sep-10 3:17
sitebuilderLuc Pattyn7-Sep-10 3:17 
GeneralRe: How does Application.DoEvents work? Pin
MicroVirus7-Sep-10 9:25
MicroVirus7-Sep-10 9:25 
AnswerRe: How does Application.DoEvents work? Pin
Johann Gerell8-Sep-10 2:41
Johann Gerell8-Sep-10 2:41 
GeneralRe: How does Application.DoEvents work? Pin
Luc Pattyn8-Sep-10 2:45
sitebuilderLuc Pattyn8-Sep-10 2:45 
GeneralRe: How does Application.DoEvents work? Pin
Spectre_0018-Sep-10 4:18
Spectre_0018-Sep-10 4:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.