C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Retrieving TCP connections information


Posted Date: 27 Mar 2007    Resource Type: Code Snippets    Category: Network

Posted By: Manikandan Balakrishnan       Member Level: Gold
Rating:     Points: 5



TCP is used to establish peer to peer communication between two computers, “TcpConnectionInformation” class is used to display the informations of existing TCP communication. This is very use full to monitor the network status.

Sample Code:


public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
//Retriving IP global properties
IPGlobalProperties IPGproperties = IPGlobalProperties.GetIPGlobalProperties();

//Retriving the TCP connections
TcpConnectionInformation[] connections = IPGproperties.GetActiveTcpConnections();

foreach (TcpConnectionInformation tcp in connections)
{
//Displaying TCP connection informations
StringBuilder sb = new StringBuilder();
sb.Append("Local endpoint:\t"+tcp.LocalEndPoint.Address.ToString());
sb.Append("\nRemote endpoint:\t"+ tcp.RemoteEndPoint.Address.ToString());
sb.Append("\nState:\t\t"+ tcp.State.ToString());
MessageBox.Show(sb.ToString(),"TCP connection status");
}

}
}





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Ping remote computer in the network
Previous Resource: Check if a port is open or closed?
Return to Discussion Resource Index
Post New Resource
Category: Network


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

fax server

Contact Us    Privacy Policy    Terms Of Use