Get TCP stream : TCP Stream : Network C# Source Code


Custom Search

C# Source Code » Network » TCP Stream »

 

Get TCP stream








    


using System;
using System.IO;
using System.Net.Sockets;

public class NetWriter {
  public static void Main(string [] args) {

    string address = "www.navioo.com";
    int port = 80;

    TcpClient client = new TcpClient(address,port);
    NetworkStream stream = client.GetStream( );

    StreamWriter writer = new StreamWriter(stream);

    writer.WriteLine("www.navioo.com\n");
    writer.Flush( );

    using (StreamReader reader = new StreamReader(stream)) {
      while (reader.Peek( ) != -1) {
        Console.WriteLine(reader.ReadLine( ));
      }
    }
  }
}
           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Network
» TCP Stream