Hi,
I'm having a weird problem... Part of code first:
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
Dim DataChunk as String
Dim FullData as String
Do While EOF = False
If networkStream.DataAvailable = True Then
networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
DataChunk = Encoding.ASCII.GetString(bytes)
DataChunk = Trim(DataChunk)
FullData = FullData & DataChunk
bytes.Clear(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
If DataChunk="EOF,AppConfirmationString"
EOF = True
End If
End If
Loop
When a number of packets is received on the socket (e.g. client sending
data line by line rather than a single stream), FullData always equals
to whatever the first packet (line) included. It just doesn't seem to
add DataChunk to itself each time loop is run. Why?
When instead of this I try adding DataChunk to a textbox, it's fine, at
the end I have all data sent to me in textbox...
--
Greets,
Arkadiusz 'Winger' Slusarczyk
Republic of Ireland 4 1466
Winger wrote: Hi,
I'm having a weird problem... Part of code first:
Dim bytes(tcpClient.ReceiveBufferSize) As Byte Dim DataChunk as String Dim FullData as String
Do While EOF = False If networkStream.DataAvailable = True Then networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize)) DataChunk = Encoding.ASCII.GetString(bytes) DataChunk = Trim(DataChunk) FullData = FullData & DataChunk bytes.Clear(bytes, 0, CInt(tcpClient.ReceiveBufferSize)) If DataChunk="EOF,AppConfirmationString" EOF = True End If End If Loop
When a number of packets is received on the socket (e.g. client sending data line by line rather than a single stream), FullData always equals to whatever the first packet (line) included. It just doesn't seem to add DataChunk to itself each time loop is run. Why? When instead of this I try adding DataChunk to a textbox, it's fine, at the end I have all data sent to me in textbox...
I am wondering if your code is contained within an Event?? If so, you
may be looking at a re-entrant issue which could cause the problem
you're describing. (Try temporarily defining "FullData" globally, that
would expose this).
Otherwise, try putting a Counter within your main Loop with output going
to the Immediate Window, or using Debug.Print(DataChunk) after each
"DataChunk = Trim(DataChunk)" line. This will show you what is being
read into that Variable.
ShaneO
There are 10 kinds of people - Those who understand Binary and those who
don't.
Hi,
ShaneO wrote: I am wondering if your code is contained within an Event?? If so, you may be looking at a re-entrant issue which could cause the problem you're describing. (Try temporarily defining "FullData" globally, that would expose this).
It's part of a function launched when there is connection pending on TCP
port.
Otherwise, try putting a Counter within your main Loop with output going to the Immediate Window, or using Debug.Print(DataChunk) after each "DataChunk = Trim(DataChunk)" line. This will show you what is being read into that Variable.
I have debugged line that is supposed to append DataChunk to Fulldata a
number of times and result was:
- when line was about to be executed, it showed me these values:
FullData = FullData & DataChunk
"String1" "String1" "String 2"
After the line was executed, FullData was still... "String 1". This is
really weird for me.
Working in VS .Net 2003 by the way.
--
Greets,
Arkadiusz 'Winger' Slusarczyk
Republic of Ireland
Winger wrote: Hi,
ShaneO wrote:
I am wondering if your code is contained within an Event?? If so, you may be looking at a re-entrant issue which could cause the problem you're describing. (Try temporarily defining "FullData" globally, that would expose this).
It's part of a function launched when there is connection pending on TCP port.
Otherwise, try putting a Counter within your main Loop with output going to the Immediate Window, or using Debug.Print(DataChunk) after each "DataChunk = Trim(DataChunk)" line. This will show you what is being read into that Variable.
I have debugged line that is supposed to append DataChunk to Fulldata a number of times and result was: - when line was about to be executed, it showed me these values: FullData = FullData & DataChunk "String1" "String1" "String 2" After the line was executed, FullData was still... "String 1". This is really weird for me. Working in VS .Net 2003 by the way.
All of the above would still indicate to me that you are indeed looking
at a re-entrant issue. It would appear your "Function" is being
simultaneously executed more than once.
Did you try globally declaring "FullData"? You will need to remove (or
REM) your "Dim FullData as String" line and declare it in the General
Declarations section at the top of your program.
I'd be interested to know the results.
ShaneO
There are 10 kinds of people - Those who understand Binary and those who
don't.
ShaneO wrote: All of the above would still indicate to me that you are indeed looking at a re-entrant issue. It would appear your "Function" is being simultaneously executed more than once.
I use threading (ThreadPool) to launch new thread that handles incoming
TCP connection. This way application can process data without blocking
listening port and I'm ready for next connection...
Yet, all tests were done with a single connection only, straight after
program was started, so new thread was created only once...
Did you try globally declaring "FullData"? You will need to remove (or REM) your "Dim FullData as String" line and declare it in the General Declarations section at the top of your program.
I've tried that, result was identical...
I will be rewriting full code anyway (have few reasons for that), I will
see wheter problem will still occur...
--
Greets,
Arkadiusz 'Winger' Slusarczyk
Republic of Ireland This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Klatuu |
last post by:
Whew, I've struggled my way through figuring out how to use XML to transport
data..now I can imagine what having a baby is like :)
But, I'm stuck now. I generate the XML (single table, no...
|
by: Patrick |
last post by:
I have got 2 XML documents, both of which conform to the same XSD Schema,
which define possible optional elements. The 2 XML documents contain 2
disjoint set of XML elements.
What is the best,...
|
by: Emmett Power |
last post by:
Hi,
I have an Access table with a number of records which refer to the
same person but with data in different fields. So for example the
table would look like this:
Name..............Field...
|
by: svdh |
last post by:
I have posed a question last saturday and have advanced alot in the
meantime. But I am still not there
Problem is that I try to merging various fields from various tables in
one document in Word...
|
by: Dan Cooper |
last post by:
I've got two datasets, each containing a single data table.
dstDataSetA.Tables("TableA")
dstDataSetB.Tables("TableB")
I want to merge them together and delete any non-matching rows.
...
| |
by: Jim Adams |
last post by:
My ASP.Net (VB.Net) app needs to display a filled in form to a web
user from the following:
a) read HTML form files (not ascx) dynamically from disk (e.g.
form.html)
b) read its corresponding...
|
by: Crirus |
last post by:
Hi all!
I use a webClient for requesting data from a server of mine.
Should I worry about long ammount of data sent by server in the client side?
Or, another way, should I send some kind of a...
|
by: google_groups3 |
last post by:
Hi all.
I currently have 2 text files which contain lists of file names. These
text files are updated by my code. What I want to do is be able to
merge these text files discarding the...
|
by: Big X |
last post by:
I have already achieved this in access and was trying with straight SQL earlier I would just like to know what I'm doing wrong in sql or what syntax I'm missing. I have three tables with identical...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |