Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 15th, 2008, 09:41 AM
Registered User
 
Join Date: Dec 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Socket Progrmming

I am trying to create a Telnet session from a C# application and be able to send commands and receive output back. Is this possible with just a regular TCPClient connecting to a host on port and then reading from/writing to the stream associated with that client? This is what I have been trying and can't figure out, thats why I didn't post any code because i really dont think I have anything that works. Any help on this would be greatly appreciated. Thanks in advance

 
Old February 17th, 2008, 03:08 PM
Authorized User
 
Join Date: Sep 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes it is possible. Any other questions? :)

A little (bad) example:
Code:
TcpClient c = new TcpClient();
c.Connect(new IPEndPoint(Dns.GetHostEntry("www.google.com").AddressList[0], 80));
NetworkStream s = c.GetStream();
StreamWriter w = new StreamWriter(s);
StreamReader r = new StreamReader(s);
w.WriteLine("GET / HTTP/1.0");
w.WriteLine();
Console.Write(r.ReadToEnd());
s.Close();
c.Close();
 
Old February 21st, 2008, 03:54 AM
Registered User
 
Join Date: Sep 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bakus
Default

Hello there.
I am new to network programing and realy ar not enaf to do it.
Please know someone what ebook I must read can I make network programing examples with "C# Visual Studio 2005.net" ?
Thank you.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Socket connections hockney General .NET 1 July 6th, 2005 04:14 AM
Socket Programming ashu_from_india General .NET 0 June 28th, 2005 12:02 PM
Socket programming vinodkalpaka J2EE 0 June 16th, 2005 02:43 AM
Socket Programming chinni Pro PHP 1 August 18th, 2003 03:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.