Winsock packetsize problems

Morning all.

   I've stumbled across a HUGE problem with my application.

I'm using winsock to send and recieve (works 100% fine).

When i RECEIVE some XML data, it arrives in 2 packets, becuase the XML DATA is too big for one packet!! I read some previous posts, etc, and found that packet size is around 8192 or something.

How do i make it so that strData == winsock.getdata from BOTH packets?! Also, my data can also get VERY LONG! so i can't hardcode the actual number of packets being received.

the main thing i cannot understand is how it KNOWS when a group of packets are part of a broken up string of data... ?

Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
    Dim strIncomingText As String
'   The incoming data is to data from ALL THE PACKETS..
    Winsock.GetData strIncomingText
End Sub


This is so confussing.

Please help :(

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You *can* increase the buffer size... But the correct answer here is "you don't".   Instead you need to append the packets together and parse on some character or characters.  Possibly some XML tag or even vbCrLf.  

Good Luck

pure032398Author Commented:
--> append the packets together ???
--> parse on some characters ???

i sorta understand what u mean .. but examples???

const vbtmpdata as string

on data arrival

vbtmpdata = vbtmpdata & winsock1.getdata
if instr(vbtmpdata,"</xml>") ' packet is done...

that gives you an idea :) Good Luck

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

pure032398Author Commented:
No acceptable answers :(

I've already figured it out.
Hello Pure.
Would you mind sharing what you did to get rid of this problem ?
I hope you didn't take any parsing approach.
Hi pure,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept BrianGEFF719's comment(s) as an answer.

pure, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer
Comment from expert accepted as answer

E-E Moderator
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.