|
-
Mar 23rd, 2005, 08:54 AM
#1
Thread Starter
Lively Member
Duplicate data with Getdata
I currently have a winsock control on a form listen for connection, once a connection has been established it starts to receive data from another application sending the data.
My problem is I send a large amount of data split up into chunks through to the listening winsock control, one after the other.
At the listening winsock control I sometimes get duplicate chunks of data and so receive more data than was actually sent.
I have checked this by writing the output to a file..please see below.
VB Code:
pstrData = ""
sckTransactionServer(Index).GetData pstrData, vbString
Open "D:\development\WebeXchange2\AuthXLoadBalancer\tcpipinput.txt" For Append As #2
Print #2, pstrData
Close #2
It looks as though the GetData buffer is not being emptied on the GetData call before the next DataArrival event is fired??
Help???
-
Mar 23rd, 2005, 02:59 PM
#2
Re: Duplicate data with Getdata
When sending data quickly, it gets 'stuck' together so lest say you sent the following
1
2
3
4
5
6
7
in a loop, the client may recieve this as
12
3
4
567
as you can see its merged together, you can combat this by using Packet Delimeters
See Here
And Here
Hope that helps
-
Mar 24th, 2005, 04:38 AM
#3
Thread Starter
Lively Member
Re: Duplicate data with Getdata
Hi,
First of all thanks for your reply. I dont think your answer isnt quite the answer to my problem, I am sending XML data and I know that the data can arrive seperate or all together so I handle that further in the program.
My problem is that I GetData on the DataArrival event and sometimes on the next DataArrival event I GetData again and some of the previous data is still in there.
So I send the following as part of say a 300 entry XML record at once
Code:
<DATA><NAME>Paul</NAME></DATA>
<DATA><NAME>Fred</NAME></DATA>
<DATA><NAME>Jo</NAME></DATA>
At the receiving end I sometimes get
Code:
<DATA><NAME>Paul</NAME></DATA>
<DATA><NAME>Fred</NAME></DATA>
<DATA><NAME>Fred</NAME></DATA>
<DATA><NAME>Jo</NAME></DATA>
Any ideas
Thanks for your help so far...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|