Login  
Search All Forums
Dart Home | PowerTCP Server for ActiveX | Custom Development Reply | PowerTCP Server for ActiveX Topics | Forums   
AuthorForum: PowerTCP Server for ActiveX
Topic: Loosing Data on the Recieve Event
adrian.watkins

From: Worcester, United Kingdom
Posts: 8
Member Since: 02/28/01
posted November 13, 2007 3:47 PM

Ive been using Dart products in some comms applications for a while, but have now come accross and issue with Windows 2003 Server lastest SPs.

The problem is that between receive events I am losing one byte of data intermittently.

I can tell for sure that the data is been lost if I turn on trace file where the data is seen and log the data picked up in the recieve event.

typically the trace showns one packet been recieved, but this becomes two separate receive events with a byte of data missing between them intermitantly.

This only happens however if the socket is from the local pc to the local pc. It doesnt appear to happen if the socket source is a remote device.It therefore appears to be tied to local socket communciations. As a workaround at the moment we have the server app running on a separate machine and this fixes it 100%.

I realise that this might be a need for an update, and if necessary I am happy to buy a new toolset, but need to be certain this will be fixed if I make that investment. If there is doubt then I will probably recode the app to another socket library to see if this fixes the data loss.

I can provide log files showing the issue.
adrian.watkins

From: Worcester, United Kingdom
Posts: 8
Member Since: 02/28/01
posted November 13, 2007 3:48 PM

BTW

Dartserver.dll 3.1.3.0
Darsocket.dll 2.8.3.10
Arjun

From: Rome, NY, USA
Posts: 137
Member Since: 09/17/07
posted November 14, 2007 1:28 PM

Hello Adrian,

Unfortunately I could not replicate the issue with the same version as mentioned. The following is the code I have used to check for the same:

Private Sub Form_Load()
Server1.Listen 7
Tcp1.Connect "servername", 7
For i = 0 To 1000
d1 = Tcp1.Send(CStr(i))
Next
End Sub

Private Sub Server1_Receive(ByVal Child As DartServerCtl.ITcp)
Dim da As String
Dim l As Long
Child.Trace "c:\tracetest.txt", True, True, "->", "<-"
l = Child.Receive(da)
Debug.Print "SERVER1 CHILD :: Length = " & l & "DATA::" & da
End Sub

Please let me know if I am missing anything.

Have a great day.

Regards,
Arjun
adrian.watkins

From: Worcester, United Kingdom
Posts: 8
Member Since: 02/28/01
posted November 14, 2007 3:49 PM

Arjun, Thanks for looking at this. I think your example may be too simple. My problem occurs when recieving a block of data so you would probably need to send more than 1 byte at a time. In additon my app is handling several clients at a time when the problem occurs. My accept process connects the socket to a new class (as per the examples).

My accept looks like:

Public Function Accept(Socket As Long)
  On Error GoTo error
  ' Accept an incoming connection
  ' NON-BLOCKING TIMEOUT.....
  COM.Timeout = 0
  log.Create "c:\DataIn" & App.ThreadID & "-" & DateFilename & ".txt"
  COM.Trace "c:\Trace" & App.ThreadID & "-" & DateFilename & ".txt", True, True, vbCrLf & "-->" & vbCrLf, vbCrLf & "<--" & vbCrLf
  COM.Socket = Socket


and my receive looks like:
...
  bytesTotal = COM.ReceiveBufferCount
  ReDim byteBuffer(bytesTotal)
  COM.Receive byteBuffer
  
  log.AddEntry "Input: " & bytesTotal & " bytes."
  Dim LogData As String
  Dim LogDecode As String
  For i = 0 To bytesTotal - 1
  LogData = LogData & Chr(byteBuffer(i))
  LogDecode = LogDecode & byteBuffer(i) & ","
  Next i
  
  log.AddEntry "Data In  :" & LogData
  log.AddEntry "Data Decode:" & LogDecode
  log.AddEntry " "
  
....
....

so hence I am recording the data with the trace function and also during my input. However to give an example comparing the two when data has been lost:


TRACE:
<--
ÿú, ÿðÿú, ÿðSET 1:0,2:0,3:0,4:10,5:0,6:5

MY LOG from Recieve event:
13/11/2007 12:13:17 : 7748 : 
13/11/2007 12:13:17 : 7748 : Input: 14 bytes.
13/11/2007 12:13:17 : 7748 : Data In  :ÿú, ÿðÿú, ÿð
13/11/2007 12:13:17 : 7748 : Data Decode:255,250,44,12,2,255,240,255,250,44,12,1,255,240,
13/11/2007 12:13:17 : 7748 : 
13/11/2007 12:13:17 : 7748 : Input: 28 bytes.
13/11/2007 12:13:17 : 7748 : Data In  :ET 1:0,2:0,3:0,4:10,5:0,6:5

13/11/2007 12:13:17 : 7748 : Data Decode:69,84,32,49,58,48,44,50,58,48,44,51,58,48,44,52,58,49,48,44,53,58,48,44,54,58,53,13,
13/11/2007 12:13:17 : 7748 : 

Many times the same data will not cause an issue. However when it does, you will see from the trace above that the data came in one packet, however this becomes two separate receive events and the data is missing from the first byte of the second receive event. In this case we are missing the "S" of Set. Not that the data contains various telnet control messages, but this does not seem to have a bearing an my application handles these.

Hope this helps. I have confirmed with my customer that by them changing the servers to that the incoming socket comes from another machine and not the same machine the application behaves perfectly. Overnight this application does a few million transactions. Previously 10,000 transactions fail due to missing data, after making the socket come from a separate machine and not the local host this was reduced to only 5.

sorry for the complex nature of the problem, but it does seem to only be effected on this platform type (2003 server) and when the originating socket comes from the same machine. I am keen to know that if I invest in latest code that it will fix the issue.
Reply | PowerTCP Server for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX