473,699 Members | 2,440 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

networkstream.r ead

I'm working on a program that talks to the Yahoo chat servers. But I have
run into a small problem and I'm not sure what to do next. After I
successfully log into yahoo and receive my cookies I think login to their
chat servers. It's at this point I am having the problem. When the following
code executes:

networkstream.R ead(bytes, 0, CInt(tcpClient2 .ReceiveBufferS ize))

Dim returndata As String = Encoding.ASCII. GetString(bytes )

txtReturndata.T ext = txtReturndata.T ext & returndata
returndata = "YCHT

There is no closing quote either which I find odd since return data is
clearly a string. I believe that there is some character or something being
received after YCHT that is causing the Encoding.ASCII. GetString to choke.
Any suggestions for a method that might work better? Thanks in advance.

Nov 20 '05 #1
1 3532
I think the problem is that the buffer is too small, either on your side or
on the sender's side. You need to increase the buffer and read from the
stream until the stream is empty. The stream probably still contains more
response from the sender. Set it on a loop:

Do
BytesRead = stream.Read(dat a, 0, data.Length)
TotalBytes += BytesRead
TotalData = [String].Concat(TotalDa ta,
System.Text.Enc oding.ASCII.Get String(data, 0, BytesRead))
Loop While stream.DataAvai lable

Good luck.

"Steve" <me**********@s tephendcarlton. com.wine> wrote in message
news:ey******** ******@TK2MSFTN GP12.phx.gbl...
I'm working on a program that talks to the Yahoo chat servers. But I have
run into a small problem and I'm not sure what to do next. After I
successfully log into yahoo and receive my cookies I think login to their
chat servers. It's at this point I am having the problem. When the following code executes:

networkstream.R ead(bytes, 0, CInt(tcpClient2 .ReceiveBufferS ize))

Dim returndata As String = Encoding.ASCII. GetString(bytes )

txtReturndata.T ext = txtReturndata.T ext & returndata
returndata = "YCHT

There is no closing quote either which I find odd since return data is
clearly a string. I believe that there is some character or something being received after YCHT that is causing the Encoding.ASCII. GetString to choke.
Any suggestions for a method that might work better? Thanks in advance.


Nov 20 '05 #2

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

Similar topics

1
556
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. I am sending a small amound of data and read where data wasn't sent until the buffer reached a larger size. However, there is a TcpClient property call NoDelay that is suppose to eliminate this delay. Here is a snippet of my code below. Can...
4
7200
by: 0to60 | last post by:
I have a class that wraps a TcpClient object and manages all the async reading of the socket. It works really nice, and I use it all over the place. But there's this ONE INSTANCE where I create one of these things and it WON'T read data. If I set a breakpoint in my EndRead callback, it never goes off. NOTHING is different from anywhere else I use this class, its just this one place. Now, if I create a second constructor for my class...
1
4783
by: Casey Watson | last post by:
Hi :) I'm having some major trouble with an XML Client/Server application that I am writing. I am using NetworkStream with CryptoStream to Read and Write XML between computers. Now, whenever I write the XML, the Server section which uses the XMLTextReader Class will not accept EndElements period, and neither the ReadStartElement or ReadEndElement will work properly. However, if I only send to WriteStartElements over the network, the...
1
2647
by: kmacintyre | last post by:
I am trying to us a simple NetworkStream to transfer a file over tcp. This works most of the time, but one specific file never downloads(.mdb file). It seems to close the socket and I get an "unable to write data to transport connection" error. I have tried multiple ways to transfer this file(including remoting, sockets without network stream) and downloaded different examples of client/server byte transfer, all with the same result....
6
3324
by: Ryan | last post by:
Hi, I am confused with how NetworkStream works. My application needs to handle heavy requests sent through TCP socket connection. I use NetworkStream.Read method to get the stream data. The
0
1344
by: Al Wilkerson | last post by:
Hey, Has anyone ever got a "Unable to read data from transport connected" message after reading data from a streamreader composed of a networkstream. For example: Server TcpListener tcpServer = new TcpListener(localAddr,port);
4
7566
by: DaveR | last post by:
I have a background thread to accept and process TCP/IP connections. When the application shuts down I want to gracefully terminate it. The thread will block in NetworkStream.Read() waiting for data. I expected that shutting down the TcpListener would unblock the Read() and cause an exception, or return 0 bytes. But it does not work. Relevant parts of the code are shown below. If a client connects, the stream blocks in its Read()...
5
4218
by: | last post by:
I've got a basic "chat" infrastructure that can send objects across the wire, but I'm running into a few issues with trying to send multiple messages and things behaving differently in debug and release... Is there anyone out there that considers themselves a threading / sockets / serialization guru? Not sure if it's appropriate to post an entire project here and the issues discussion is probably a bit too complex for newsgroup back and...
3
11033
by: shahla.saeed | last post by:
hi, plzz check my code and let me know where the problem is lying...becuase whenever i try to tansfer the file of 573KB(mp3) it just tranfer few Kb of file(Somtimes 5.2Kb,somtimes 32Kb..every time i run the program).....but when i watch the transfering of bytes by debuging it.(RED dot on while(nfs.CanRead) )..it shows that complete bytes are transfered.(in my case i-e 573Kb)....i am unable to understand whats going wrong in my program....
7
4268
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 results to clients. The code below makes the client application not to respond. Client can send data but is stuck in the process of waiting information back from the server. Any ideas?
0
8703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8623
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9185
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9050
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8893
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6540
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3069
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 we have to send another system
2
2359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
bsmnconsultancy
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.