• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 637
  • Last Modified:

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 :(

1 Solution
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now