networkstream return white space.

G

Guoqi Zheng

Dear sir,

I am using .NET tcpClient to connect to remote POP server. When I get the
string from server response, the string always contains many white space.

I think the ReceiveBufferSize is always too big, it seems to me that server
always response with a fix buffer size, but send the response stream in 3
times. I tried to get rid of those white space by trim or regex, but not any
lucky,

any one understand what I am taking about?

Any help will be appreciated!!! Please see my code example below.

Do While (qqNetworkStream.DataAvailable)

Dim bytes(qqTcpClient.ReceiveBufferSize) As Byte

qqNetworkStream.Read(bytes, 0, CInt(qqTcpClient.ReceiveBufferSize))

Dim tempString As String = System.Text.Encoding.UTF8.GetString(bytes)

Tmr = Now.TimeOfDay.TotalSeconds - Start

Dim boolTest As Boolean = False

boolTest = Regex.IsMatch(fReturn, "\r\n\.\r\n",
RegexOptions.Singleline)

If boolTest = True Or Tmr > m_TimeOut Then

Exit Do

End If

System.Threading.Thread.Sleep(300)

Loop

Return tempString



--
Kind regards

Guoqi Zheng
guoqi AT meetholland dot com
Http://www.meetholland.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

vb.net pop3 class 2
help with FTP clients. 1

Top