Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / November 2003

Tip: Looking for answers? Try searching our database.

Problem with 'TcpClient'

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eugene Lerner - 06 Nov 2003 19:15 GMT
I execute these steps -

TcpClient MyTcpClient = new TcpClient( . );
MyTcpClient.Connect( . ); //Connect to Server
NetworkStream MyNetworkStream;
MyNetworkStream = MyTcpClient.GetStream( ); //Get Network
Stream
IAsyncResult MyAsyncResult = NetworkStream.BeginRead(
. ); //Start asynchronous read
MyAsyncResult.AsyncWaitHandle.WaitOne( ); //Wait
infinitely for TCP Server to write something into socket
int ReadCount = MyNetworkStream.EndRead(
MyAsyncResult ); //Get number of bytes read

Here is a problem I'm having:
Sometimes "WaitOne" call returns but subsequent "EndRead"
returns 0 (zero) bytes were read from the socket. Could
this be that I'm doing something wrong or TCP server has
a bug?

Thank you
Feroze [MSFT] - 06 Nov 2003 20:20 GMT
That means that the peer closed the connection gracefully.You need to look
at the server code to see why the connection is getting closed.

Signature

Remove "user" from the email address to reply to the author.

This posting is provided "AS IS" with no warranties, and confers no rights

Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

> I execute these steps -
>
[quoted text clipped - 17 lines]
>
> Thank you

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.