Windows XP Echo Port

Unanswered Question
Oct 2nd, 2008

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

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 3 (1 ratings)
Loading.
rayroyalmontana Thu, 10/02/2008 - 09:57

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();

}

}

}

Jon Marshall Thu, 10/02/2008 - 10:41

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

rayroyalmontana Thu, 10/02/2008 - 10:49

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

Jon Marshall Thu, 10/02/2008 - 10:51

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

Actions

This Discussion