פורסם 2007 ביוני 818 שנים שלום כתבתי קוד ב vb.net 2005 להורדת הודעה מקבוצות דיון והצגתו ב textboxהקוד עובד, אך רק עם הודעות קטנות בהודעות גדולות הקוד מציג רק את תחילת ההודעה.Imports System.XmlImports System.Net.SocketsImports System.TextPublic Class Form1Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadDim _username As String = "********"Dim _password As String = "********"Dim tcpClient As New TcpClientDim sendBytes As [Byte]()Dim _buffer As StringtcpClient.Connect("news.giganews.com", 119)Dim networkStream As NetworkStream = tcpClient.GetStream()'Read the Welcome message into a byte buffer.Dim bytes(tcpClient.ReceiveBufferSize) As BytenetworkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))'send username to the serversendBytes = Encoding.ASCII.GetBytes("AUTHINFO USER " & _username & vbCrLf)networkStream.Write(sendBytes, 0, sendBytes.Length)ReDim bytes(tcpClient.ReceiveBufferSize)NetworkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))' Send Passwrod to the serversendBytes = Encoding.ASCII.GetBytes("AUTHINFO PASS " & _password & vbCrLf)networkStream.Write(sendBytes, 0, sendBytes.Length)ReDim bytes(tcpClient.ReceiveBufferSize)networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))'reset the buffer_buffer = ""'send command to get the message bodysendBytes = Encoding.ASCII.GetBytes("BODY <4637803c$0$32575$6c4159fb@tele2news.tweaknews.nl>" & vbCrLf)networkStream.Write(sendBytes, 0, sendBytes.Length)' Read the NetworkStream into a byte buffer.ReDim bytes(tcpClient.ReceiveBufferSize)networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))_buffer = _buffer & Encoding.GetEncoding("windows-1255").GetString(bytes)While networkStream.DataAvailable = TrueReDim bytes(tcpClient.ReceiveBufferSize)networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))_buffer = _buffer & Encoding.GetEncoding("windows-1255").GetString(bytes)End WhileTextBox1.Text = _bufferEnd SubEnd Classאני חושב שיש בעיה בשורה של ה while והתנאי שם לא מתאים והקוד יוצא מהלולאה לפני שהוא מוריד את כל ההודעה אבל לא הצלחתי ליצור תנאי אחר מתאיםתודה רבה
פורסם 2007 ביוני 918 שנים מחבר נסיתי לעבוד עם stream אבל לא הצלחתי ואני לא יודע כל כך איך לעבוד עם streamאתה יכול בבקשה לתת דוגמא שממנה אוכל ללמודתודה
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.