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 / Languages / Managed C++ / November 2004

Tip: Looking for answers? Try searching our database.

TCP, Sockets, Blocking etc

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rob - 27 Nov 2004 18:15 GMT
I'm pretty new to VB .net and Network coding, what I'm trying to do is
interact with a NNTP server to retrieve a list of news groups.

When I run thru' debug I basically get what I'm after, when I run without
debug the results vary - which to me suggests it's some form of sync problem
with my 'writes and reads'.

I've set up a connection to a server and have sent a 'List' command to get a
'group list', I've set up my connection buffer at 32k, I'm assuming I'm
blocking on the stream read, the question is how to I control receiving a
complete returned message - which could be 500k. I've tried various do-loop
controls, some based on MSDN examples such as 'Loop While
NStream.DataAvailable' and the attached which I'd hoped would loop until a
message which was less then the complete buffer was returned - but it all
seems hit and miss.

thanks

       Dim numberOfBytesRead As Integer = 0
       Dim sb As New StringBuilder

       Do
           numberOfBytesRead = NStream.Read(bytes, 0, CInt
Connection.ReceiveBufferSize))
           If numberOfBytesRead = 0 Then
               Exit Do
           End If
          sb.Append(Encoding.ASCII.GetString(bytes, 0, numberOfBytesRead))
           totallength = sb.Length
       Loop Until numberOfBytesRead < Connection.ReceiveBufferSize
Carl Daniel [VC++ MVP] - 27 Nov 2004 18:48 GMT
> I'm pretty new to VB .net and Network coding, what I'm trying to do is
> interact with a NNTP server to retrieve a list of news groups.

You might want to post to microsoft.public.dotnet.languages.vb.  This group
is for C++.

-cd

Rate this thread:







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.