473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Which site is a port connected to ?

Is it at all possible to monitor a port, and when there is a connection made
to a remote server by some other 3rd party app, my app could report that the
socket is connected, and can report the IP address that the port is
connected to ?

Websites:
http://www.thelisters.co.uk/
http://www.myschoolmates.com/
Nov 17 '05 #1
7 1161
c:\>netstat -a

Craig Lister wrote:
Is it at all possible to monitor a port, and when there is a connection made
to a remote server by some other 3rd party app, my app could report that the
socket is connected, and can report the IP address that the port is
connected to ?

Websites:
http://www.thelisters.co.uk/
http://www.myschoolmates.com/

Nov 17 '05 #2
That's the dirty way of doing it, but I guess I can pipe the output to a
file, and then do some work on the file to achieve the desired outcome. But
... how do I execute a dos command from c#? (Basic question.. I know...)
"jeremiah johnson" <na*******@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
c:\>netstat -a

Craig Lister wrote:
Is it at all possible to monitor a port, and when there is a connection
made to a remote server by some other 3rd party app, my app could report
that the socket is connected, and can report the IP address that the port
is connected to ?

Websites:
http://www.thelisters.co.uk/
http://www.myschoolmates.com/


Nov 17 '05 #3
using System.Diagnostics;

....

Process p = new Process();

p.StartInfo.FileName = "netstat";
p.StartInfo.Arguments = "-a";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.Start();

string output = p.StandardOutput.ReadToEnd();

// do something with output.

Nov 17 '05 #4
Thank you very much for that!

<na*******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
using System.Diagnostics;

...

Process p = new Process();

p.StartInfo.FileName = "netstat";
p.StartInfo.Arguments = "-a";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.Start();

string output = p.StandardOutput.ReadToEnd();

// do something with output.

Nov 17 '05 #5
Is it possible to hide the DOS PROMPT window that pops up ?

<na*******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
using System.Diagnostics;

...

Process p = new Process();

p.StartInfo.FileName = "netstat";
p.StartInfo.Arguments = "-a";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.Start();

string output = p.StandardOutput.ReadToEnd();

// do something with output.

Nov 17 '05 #6

"Craig Lister" <in********@removethelisters.co.uk> wrote in message
news:43*********************@news.zen.co.uk...
Is it possible to hide the DOS PROMPT window that pops up ?

Try
p.StartInvo.CreateNoWindow = false;

Can't recall if that works for the console or not, but its worth a shot. <na*******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
using System.Diagnostics;

...

Process p = new Process();

p.StartInfo.FileName = "netstat";
p.StartInfo.Arguments = "-a";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.Start();

string output = p.StandardOutput.ReadToEnd();

// do something with output.


Nov 17 '05 #7
Thanks for that!

p.StartInfo.CreateNoWindow = true;

worked like a charm!

"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:Ox**************@TK2MSFTNGP14.phx.gbl...

"Craig Lister" <in********@removethelisters.co.uk> wrote in message
news:43*********************@news.zen.co.uk...
Is it possible to hide the DOS PROMPT window that pops up ?


Try
p.StartInvo.CreateNoWindow = false;

Can't recall if that works for the console or not, but its worth a shot.
<na*******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
using System.Diagnostics;

...

Process p = new Process();

p.StartInfo.FileName = "netstat";
p.StartInfo.Arguments = "-a";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.Start();

string output = p.StandardOutput.ReadToEnd();

// do something with output.



Nov 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MLH | last post by:
I found some code Dev Ashish posted nearly a decade ago in response to someone's inquiry describing their need to dial a number, monitor call progress and determine whether it was busy. This was...
3
by: Ramakant Kasar | last post by:
Hi, If an application is reading data from a serial port, How can I open the same serial port with another application? Any idea? Please help. Thanks, Ramakant K.
20
by: Dr. Colombes | last post by:
For a personal Web site with modest throughput and interactivity demans, I'm interested in your recommendation(s) for good (cheap, reliable, Linux friendly, very little, if any, sponsor...
4
by: H J van Rooyen | last post by:
Hi All, I am writing a polling controller for an RS-485 line that has several addressable devices connected. It is a small access control system. All is well- the code runs for anything from...
1
by: sujith[arsse] | last post by:
Hi all, I'm new to this community,so i think i shall introduce myself first, I'm a developer in VC++ 6.0 for past few years, Now my mission to post this thread is how can i find "Is any...
0
by: Bojan | last post by:
I am working on some program that has to comunicate at low baud rates. Problem is that data is sometime transmitted, and sometime not. There is no pattern in that. I tried it on HP6515 and Toradex...
0
by: | last post by:
I have written a few device classes that use the Serialport class with no problems what so ever. I finally ran into a device that need to have the Dtrenable flag set to true in order to...
1
by: zahid313 | last post by:
what do i have to do to get the IP address connected to my computer on a certain port, after i provide the port number. remote computer is already connected to a certain port and i know that...
3
by: Charming12 | last post by:
Hi All, I have to deal with some devices like Pen Tablet, WebCam etc to work for a product. Now my Problem is some times while working , I am not able to tell whether a certain device is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.