Dart Home | C++ Professional Toolkit | Custom Development | Reply | C++ Professional Toolkit Topics | Forums |
Author | Forum: C++ Professional Toolkit Topic: overwriting the contents of the buffer |
User776 Posts: 1 Member Since: 04/24/01 |
posted April 24, 2001 11:26 AM This is a bit of code we use to send data down the TCP socket. The Timeout is 0 so it is non blocking. It is based within the context of an apartment threaded active x dll which is in turn housed within a C++ service. My problem is this... If we submit a large number of messages we may see the following behaviour. A sequence of three messages will be processed in such a manner that the Send is called for all three before the sendbuffercount check is made. So you see three entries in log for the distinct messages followed by three entries of "Message Accepted!". The tracing from the TCP component then shows that the last message input is then sent out 3 times and the first two are lost. It therefore looks like each subsequent message overwrites the previous ones when we call Send. How can I avoid this? Public Function SendData(s As String) As Boolean On Error GoTo ErrorHandler If Not m_oLog Is Nothing Then Call m_oLog.AddEntry(GENERAL_INFO, "Sending " & "'" & s & "'") End If Dim Count As Long Count = m_oClient.Send(s) ' SendBufferCount will normally be 0, indicating the data was accepted If m_oClient.SendBufferCount > 0 Then If Not m_oLog Is Nothing Then Call m_oLog.AddEntry(WARNING, "System didn't immediately accept data") End If Else If Not m_oLog Is Nothing Then Call m_oLog.AddEntry(GENERAL_INFO, "Message accepted!") End If End If SendData = True Exit Function ErrorHandler: If Not m_oLog Is Nothing Then Call m_oLog.AddEntry(WARNING, "Error #" + CStr(Err.Number) + ": " + Err.Description, Err.Number) End If SendData = False End Function |
Tony Priest From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted April 24, 2001 12:11 PM We will not be able to solve this one on the forum. Please contact sales and get priority support, then create a VERY SIMPLE project that we can debug here and send it to support@dart.com Thanks, Tony Priest Dart Tech Support |
Jean-Paul Raven From: London, United Kingdom Posts: 2 Member Since: 10/23/03 |
posted October 23, 2003 11:12 AM I have exactly the same problem (see my posting of Oct 23). Unfortunately, I cannot reproduce the problem with a simple program as it only happens under heavy load. Have you managed to resolve this problem? Regards, Jean-Paul |
Tony Priest From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted October 23, 2003 11:29 AM No, the user never contacted us. |
Reply | C++ Professional Toolkit Topics | Forums |
This site is powered by PowerTCP WebServer for ActiveX |