473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Threads created by the use of NetworkStream?

TDC
I'm working on tying in a library that uses a
TcpClient/NetworkStream/BeginRead. When that lib object is started, it
connects and immediately does a BeginRead that stays pending until the
socket is closed some time later.

(As is common, as data is received it is placed in a buffer and then
rolls back into another BeginRead. For the purposes of troubleshooting
I've not initiated any action that would cause data to come in, so as
to exclude that code from testing. So back to the topic.)

When the shutdown routine is called I can see two therads running. One
at "Highest" priority that never seesm to eneter into .NET code and
another "Normal" priority one that enters the BeginRead callback
handler (presumably from the threadpool).

Now the problem. I never see those two threads disappear from the
Threads debug window afterwards. Does anyone have any idea as to what
is going on?

TIA,
Tom

Jul 14 '06 #1
2 1569
"TDC" <NO***********@lycos.comwrote:
I'm working on tying in a library that uses a
TcpClient/NetworkStream/BeginRead. When that lib object is started, it
connects and immediately does a BeginRead that stays pending until the
socket is closed some time later.

(As is common, as data is received it is placed in a buffer and then
rolls back into another BeginRead. For the purposes of troubleshooting
I've not initiated any action that would cause data to come in, so as
to exclude that code from testing. So back to the topic.)

When the shutdown routine is called I can see two therads running. One
at "Highest" priority that never seesm to eneter into .NET code and
another "Normal" priority one that enters the BeginRead callback
handler (presumably from the threadpool).

Now the problem. I never see those two threads disappear from the
Threads debug window afterwards. Does anyone have any idea as to what
is going on?
What exactly is the problem?

-- Barry

--
http://barrkel.blogspot.com/
Jul 14 '06 #2
TDC
The threads seem to prevent the hosting ActiveX exe from shutting down.
When the same dll is used with all code references to this one
TcpClient-based library removed then it shuts-down just fine.

Tom

It seems that those threads are

Barry Kelly wrote:
"TDC" <NO***********@lycos.comwrote:
I'm working on tying in a library that uses a
TcpClient/NetworkStream/BeginRead. When that lib object is started, it
connects and immediately does a BeginRead that stays pending until the
socket is closed some time later.

(As is common, as data is received it is placed in a buffer and then
rolls back into another BeginRead. For the purposes of troubleshooting
I've not initiated any action that would cause data to come in, so as
to exclude that code from testing. So back to the topic.)

When the shutdown routine is called I can see two therads running. One
at "Highest" priority that never seesm to eneter into .NET code and
another "Normal" priority one that enters the BeginRead callback
handler (presumably from the threadpool).

Now the problem. I never see those two threads disappear from the
Threads debug window afterwards. Does anyone have any idea as to what
is going on?

What exactly is the problem?

-- Barry

--
http://barrkel.blogspot.com/
Jul 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: cmjman | last post by:
I have an issue where networkStream.Write doesn't perform its write downstream from my client program until the network stream is closed. I then see the data that was sent appear on the other side....
22
by: Jeff Louie | last post by:
Well I wonder if my old brain can handle threading. Dose this code look reasonable. Regards, Jeff using System; using System.Diagnostics; using System.IO; using System.Threading;
0
by: Abubakar | last post by:
Hi, try { int x = ns.Read(readbuffer, 0, readbuffer.Length); } catch (System.IO.IOException ioexception) { UINotifications.ServerMessageDisplay(ioexception.ToString( )); }
0
by: gueverson | last post by:
Hello I am new to threads and I don't have too much idea. So as to learn I was thinking to create a simple multithreaded server. There are several clients that send data to the server as a kind of...
4
by: Ryan Liu | last post by:
TcpClient has a method called GetworkStream GetStream(); So in other words, there is only one stream associate with it for input and output, right? So while it is receiving, it can not send, and...
6
by: roblugt | last post by:
I have what I imagine is a well-known .Net networking problem, but even though I've Googled for some time I've not yet come across a thread where this has been fully explained... There is a...
2
by: Dan Holmes | last post by:
The following is the start of an application that will eventually run as a service. It listens on port 23 and emulates VT100. I would like some feedback on the network stream reading and writing....
7
by: littleIO | last post by:
Hi, I'm stuck on a very simple problem and just cant seem to get around it, little help would be much appreciated. I have a server which listens, receives calls, processes them and sends back the...
1
by: selvialagar | last post by:
I'm explain my problem.. sockWriter=new Sender(); sockWriter->client =new TcpClient(); sockWriter->client->Connect(this->hostName,this->port_number); ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.