Results 1 to 3 of 3

Thread: Duplicate data with Getdata

  1. #1

    Thread Starter
    Lively Member reado's Avatar
    Join Date
    Mar 2005
    Posts
    78

    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:
    1. pstrData = ""
    2.    sckTransactionServer(Index).GetData pstrData, vbString
    3.  
    4.   Open "D:\development\WebeXchange2\AuthXLoadBalancer\tcpipinput.txt" For Append As #2
    5.       Print #2, pstrData
    6.    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???

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    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

  3. #3

    Thread Starter
    Lively Member reado's Avatar
    Join Date
    Mar 2005
    Posts
    78

    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
  •  



Click Here to Expand Forum to Full Width