Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Windows XP Echo Port

Does Windows XP Home Edition have an Echo port, or is there a way to set up an Echo port?

5 REPLIES
New Member

Re: Windows XP Echo Port

I know on some systems the Echo port is port 7, but it doesn't seem to be working in this situation?

This is the C# code I am working with:

using System; // For String, Int32, Console, ArgumentException

using System.Text; // For Encoding

using System.IO; // For IOException

using System.Net.Sockets; // For TcpClient, NetworkStream, SocketException

class TcpEchoClient {

static void Main(string[] args) {

if ((args.Length < 2) || (args.Length > 3)) { // Test for correct # of args

throw new ArgumentException("Parameters: []");

}

String server = args[0]; // Server name or IP address

// Convert input String to bytes

byte[] byteBuffer = Encoding.ASCII.GetBytes(args[1]);

// Use port argument if supplied, otherwise default to 7

int servPort = (args.Length == 3) ? Int32.Parse(args[2]) : 7;

TcpClient client = null;

NetworkStream netStream = null;

try {

// Create socket that is connected to server on specified port

client = new TcpClient(server, servPort);

Console.WriteLine("Connected to server... sending echo string");

netStream = client.GetStream();

// Send the encoded string to the server

netStream.Write(byteBuffer, 0, byteBuffer.Length);

Console.WriteLine("Sent {0} bytes to server...", byteBuffer.Length);

int totalBytesRcvd = 0; // Total bytes received so far

int bytesRcvd = 0; // Bytes received in last read

// Receive the same string back from the server

while (totalBytesRcvd < byteBuffer.Length) {

if ((bytesRcvd = netStream.Read(byteBuffer, totalBytesRcvd,

byteBuffer.Length - totalBytesRcvd)) == 0) {

Console.WriteLine("Connection closed prematurely.");

break;

}

totalBytesRcvd += bytesRcvd;

}

Console.WriteLine("Received {0} bytes from server: {1}", totalBytesRcvd,

Encoding.ASCII.GetString(byteBuffer, 0, totalBytesRcvd));

} catch (Exception e) {

Console.WriteLine(e.Message);

} finally {

netStream.Close();

client.Close();

}

}

}

New Member

Re: Windows XP Echo Port

Is there another web site I would go to for getting this question answered?

Hall of Fame Super Blue

Re: Windows XP Echo Port

Ray

I'm afraid that these forums are for Cisco specific or general networking issues but unfortunately this does not cover your problem.

I think the problem you have is that you need some sort of server ie. windows 2003 server or perhaps a machine running a variant of Linux where you can run the services you need ie. telnet/echo.

Because XP is meant for client workstations services such as telnet and echo etc.. are not provided because they are generally not needed on these type of machines.

Edit - just seen your last post. You could try

1) microsoft for information on XP

2) Google is good place to start. I found a number of threads there with the same problem you are facing.

3) The newsgroups have groups for both programming and windows specific programming.

Jon

New Member

Re: Windows XP Echo Port

I have installed a Telnet server on my Windows XP system. Is there some way to use the "echo" service with this?

Hall of Fame Super Blue

Re: Windows XP Echo Port

AFAIK a telnet server will not perform as an echo server. All an echo server does it is repeat back what you have sent.

You could modify your code to connect to telnet server and do something but i'm afraid i don't have much familiarity with C#.

Jon

444
Views
3
Helpful
5
Replies