Solved

Winsock packetsize problems

Posted on 2001-06-12
7
624 Views
Last Modified: 2013-11-13
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.


PROBLEM
^^^^^^
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... ?

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

-PK-
0
Comment
Question by:pure032398
7 Comments
 
LVL 3

Expert Comment

by:wpsjr1
Comment Utility
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

Paul
0
 
LVL 1

Author Comment

by:pure032398
Comment Utility
--> append the packets together ???
--> parse on some characters ???


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

-PK-
0
 
LVL 19

Accepted Solution

by:
BrianGEFF719 earned 200 total points
Comment Utility
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
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 1

Author Comment

by:pure032398
Comment Utility
No acceptable answers :(

I've already figured it out.
0
 
LVL 8

Expert Comment

by:stefanx
Comment Utility
Hello Pure.
Would you mind sharing what you did to get rid of this problem ?
I hope you didn't take any parsing approach.
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
0
 
LVL 1

Expert Comment

by:Computer101
Comment Utility
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now