473,468 Members | 1,315 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

TcpClient.GetStream can return null ?!?!?

Has anyone seen this happen?

I have seen it on a system that is making lots and lots of short lived connections. At this point I'm not sure of the high water mark for the number of connections. Maybe I'm just running out of some kind of resource and the .NET framework is not doing a good job at reporting it.

Any other ideas on what might cause it?

Thanks.

ti**************@mindspringXXX.com

(Note remove the XXX's to email me directly.)
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Apr 5 '06 #1
2 4025
Hello, Tim!

TL> I have seen it on a system that is making lots and lots of short lived
TL> connections. At this point I'm not sure of the high water mark for the
TL> number of connections. Maybe I'm just running out of some kind of
TL> resource and the .NET framework is not doing a good job at reporting
TL> it.

TL> Any other ideas on what might cause it?

Strange TcpClient.GetStream() can't return null in normal conditions.

IMO this may happen in multithreaded environment, when TcpClient.Dispose is called, while another thread
is calling TcpCleint.GetStream().

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Apr 6 '06 #2
| IMO this may happen in multithreaded environment, when TcpClient.Dispose
is called, while another thread
| is calling TcpCleint.GetStream().

Agree. Dispose is also called by Close(), so if thread1 called Close() and
thread2 called GetStream() and a thread switch was called at a certain
time, it looks like it could happen. The odds look better to win lottery,
but I guess it could happen. It is marked at not thread safe, so you should
sync access with a lock. It would be interesting to see a small code sample
that catches this error happening.
--
wjs
Apr 6 '06 #3

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

Similar topics

0
by: Jim | last post by:
I'm working on my first .net project using c#. I've been using activex controls embedded in a web page and wanted to do the same in ..net. My approach has been to create a windows control library...
2
by: Theo | last post by:
Hi, I am using a tcpclient and a tcplistener to send and receive packets. The client sends a packet and the listener replies with another one. I can send 2 packets and get an answer from the...
3
by: מורדי | last post by:
Hi, I'm writing a client/server application in which the client send a series of screenshots to the server to be saved using the tcpclient. in most cases the first screenshot is transmitted ok...
0
by: Hawk Wu via DotNetMonster.com | last post by:
Hello, I have odd problem. When I close my application wait around 5 minute. The pocket of screen will show one message "System.Net.Sockets.Tcpclient" of message box. My source code as below. ...
3
by: Ricardo Quintanilla | last post by:
i had a problem whom i do not know how to explain. i was using a TcpClient (System.Net.Sockets.TcpClient) object to send and receive data to an AS400 socket. Two months ago it started to work...
3
by: Danny Tuppeny | last post by:
Hi all, I'm trying to send a null character as a string delimiter through a TcpClient (code below). It's to connect to this poker bot room: http://games.cs.ualberta.ca/webgames/poker/bots.html...
1
by: Frank | last post by:
I wonder if anyone could give me a suggestion on how to best handle this scenario. I wish to have an aspx page contact a server and receive messages. Initially, a login messge is sent, then...
1
by: Ryan Liu | last post by:
Hi, Why TcpClient has a method TcpClient.GetStream(), not just a read only property? By implementing it as a method, does that mean, each time GetStream() could return a different stream? In...
0
by: sternr | last post by:
Hey, I'm using a TcpClient to create HTTP requests to my web-server (I know of HttpWebRequest, it is mandatory for me to use TcpClient.). Here's my code: TcpClient tcp = new...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.