Solved

Winsock packetsize problems

Posted on 2001-06-12
7
626 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
ID: 6184307
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
ID: 6184484
--> 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
ID: 6184845
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 1

Author Comment

by:pure032398
ID: 6200558
No acceptable answers :(

I've already figured it out.
0
 
LVL 8

Expert Comment

by:stefanx
ID: 7019420
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
ID: 7135997
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
ID: 7169190
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

785 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