cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
786
Views
3
Helpful
5
Replies

Windows XP Echo Port

rayroyalmontana
Level 1
Level 1

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

5 Replies 5

rayroyalmontana
Level 1
Level 1

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

}

}

}

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

Jon Marshall
Hall of Fame
Hall of Fame

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

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

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

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: