2012-03-19 3 views
0

내 코드는 아래에서 복사 한 Read bytes from NetworkStream (Hangs)과 매우 비슷하게 보입니다. (I 실현이 C#을하다 - 나는 VB 솔루션이 필요합니다)vb- networkstream 쓰기는 첫 번째 결과 만 반환합니다. (모두 필요)

 // Create a TcpClient. 
     // Note, for this client to work you need to have a TcpServer 
     // connected to the same address as specified by the server, port 
     // combination. 

    TcpClient client = new TcpClient(server, port); 

     // Translate the passed message into ASCII and store it as a Byte array. 
     Byte[] data = System.Text.Encoding.ASCII.GetBytes(message); 

     // Get a client stream for reading and writing. 
     NetworkStream stream = client.GetStream(); 

     // Send the message to the connected TcpServer. 
     stream.Write(data, 0, data.Length); 
     Console.WriteLine("Sent: {0}", message); 

     // Receive the TcpServer.response. 
     // Buffer to store the response bytes. 
data = new Byte[256]; 

     // String to store the response ASCII representation. 
     String responseData = String.Empty; 

     // Read the first batch of the TcpServer response bytes. 
     Int32 bytes = stream.Read(data, 0, data.Length); 
     responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes); 

     Console.WriteLine("Received: {0}", responseData); 

     // Close everything. 
     stream.Close(); client.Close(); 

내 문제는이에있다 :

나는 (찾을 수있는 TIF 파일 (들)에서 사용자의 입력을 받아 양식을 가지고있는이 종료 (getBytes (message)가 됨). 이 작업을 수행하면 항상 하나의 결과, 즉 기준에 맞는 첫 번째 tif 파일이 반환되지만, 특정 인스턴스에서는 두 개 이상의 일치를 수신해야합니다.

그럼 난에 PictureBox에 결과를 보내 내가 여러 결과를 얻을 수있는 몇 가지 방법을 시도했습니다

(이 부분은 잘 작동) 결과를 스크롤 할 수 있어야한다,하지만 어쩌면 내가 누락 분명한? 내 가장 좋은 추측은 비동기식 beginread/write를 사용하고 있습니다 ... for 루프를 사용하려고했으나 결과적으로 같은 tif 파일을 얻게되었습니다 ...

누구든지 나를 도울 수 있습니까? 일반적인 방향으로도)? 나는 프로가 아니야. 도움에 미리 감사드립니다.

+0

게시 된 코드는 C#이지만 VB 도움말을 요청하고 있습니까? –

+0

하지만 한 메시지를 보내고받는 중입니다. 무엇을 시도 했습니까? 코드가 어떻게 보이나요 ?? (진짜) .. – gbianchi

+0

그래 - VB는 매우 비슷합니다 .. 거의 동일합니다 .. 내 파일은 (고정 길이가 아닌) 큰 수 있기 때문에 비록 내 파일을 얻으려고 노력하고 forloop – GetBrutal

답변

0

문제점이 무엇인지 알아 냈습니다. 찾고 있던 데이터는 표준화되지 않았으므로 결과는 동일한 데이터였습니다. 내가 찾고있는 항목을 변경하고 타다 효과가 있습니다. 어쨌든, 도움 주셔서 감사합니다

관련 문제