.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Get the port number associated with a process

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :WPF

Hi All.


I am working on a remoting application wherein the server starts, registers itself at a port available and then the client has to listen to that port. I cannot give the port number statically as it might be used already by some other process. I register the server at port 0 (port 0 means the application has to find an available port).


Now, can I get the port number that the application managed to find out? Whenever I try yo do this, I get '0' as the port number.


Looking the other way round, can I get the port number associated with the process id of the server? If I can do this, I will be able to let the client listen to the port associated with the server.


Thanks in advance


View Complete Post

More Related Resource Links

IIS - sharepoint/default website port number confusion



I have MOSS 2007 installed with IIS V7.

My default web site port is 80. When I created a new web application for my main sharepoint portal I also set it to 80. So obviously now the default web site port shows as stopped in IIS and it won't start.

What are the best practices. Should I change the port number for my portal to something else? I mean is it even a good idea to have sharepoint on port 80? If so, how do I go about changing the port number for my portal site?

any help appreciated.

Ping IpAddress with Port number?

I am using System.Net.NetworkInformation with Ping method.   But it seems like it can only ping IPAddress. What should I need to do if I need to find out whether a port of the IPaddress is available?   Let me know. I will reward you.   Thanks

Specify Instance Port Number on Command Line Install

Is there a way to specify which port we want our named SQL Express instance to run on during a command line install with no interaction from the user?  If not, is there a way we can change the dynamic port selected after the install without any user interaction?Nick's Programming Tips

Visual studio 2005 - Port Number is difference during run time.

Hi, When I debug(F5), the port number display in the URL is difference from the ASP.net development server. Eg: URL address port number is  - 1084, while for the Server is 1088 I have tried difference ways such as trying to set the dynamic port to false, so that I can configure my own port, but it is not able to work. I have also turned off the ESet Firewall however the port number is still difference.  Need your help in this area.. Thank you! 

Use Report Builder 3.0 with SharePoint site using a port number

We are currently working with SSRS R2 and SharePoint 2010.  SharePoint 2010 has been deployed a multitenant solution.  SharePoint and SSRS are on separate servers.  We have successfully integrated the two products but are experiencing some anomolies.  The SharePoint site we are deploying to uses a port number (e.g. http://mysharepointsvr:2222).  When you launch Report Builder from this site, it does not open connected to a Report Server.  When you try to connect to a Report Server the obvious choice is to put in http://mysharepointsvr:2222 for the Report Server service.  However, this does not work.  We are getting the following error: Connection Failed.  Unable to connect to the server that is specified in the URL, 'http://mysharepointsvr:2222'.  Make sure the server is running, the URL is correct, and you have permission to use the server. However, if we use the SharePoint address without the port number it will connect.  This does not work as the SharePoint port determines which site we are directed to for resources.  In our case, we need to be able to browse the folders on port 2222 not port 80 (default).  As far as the error above is concerned, we are able to browse to the report server (http://sql101/reportserver) and see all of the SharePoint sites.  In all cases, identical credentials are being u

can only connect to instance via port number

I can connect to an instance by specifying the port but not by the instance name. Becuase of this, no replication is occuring. Please see porqry and sqlcmd output below ...   d:\>portqry -n MDLEXPSV02 -p udp -e 1434 Querying target system called:  MDLEXPSV02 Attempting to resolve name to IP address... Name resolved to querying... UDP port 1434 (ms-sql-m service): LISTENING or FILTERED Sending SQL Server query to UDP port 1434... Server's response: ServerName MDLEXPSV02 InstanceName SQLEXPRESS IsClustered No Version 9.00.4035.00 tcp 1184 np \\MDLEXPSV02\pipe\MSSQL$SQLEXPRESS\sql\query      ?  ?P'   % ==== End of SQL Server query response ==== UDP port 1434 is LISTENING d:\>sqlcmd -U sa -S MDLEXPSV02\SQLEXPRESS -P sapwd HResult 0xFFFFFFFF, Level 16, State 1 SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establi shing a connection to the server. When connecting to SQL Server 2005, this failu re may be caused by the fact that under the default settings SQL Server does not  allow remote connections.. Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired. d:\>sqlcmd -U sa -S MDLEXPSV02\SQLEXPRESS,1184 -P sapwd 1> exit d:\>

Public URL Port Number appended for WebTaggingDialog.aspx page

Hi, I am not sure if this the right place to ask this question, We have a SarePoint site exposed to internet which has a web application at 8081 port. There server is behind a firewall which proxying 80 port network to 8081 port of SharePoint server. All Pages, Content and Images are working perfect but only the pages related to Taxonomy Store has port number appended to url which is not accepted at the firewal for example if the http://abc:8081 is my site the internet url is http://sharepoint.com all this is working but if is open page with WebTaggingControl or List with taxonomy fields the url http://sharepoint.com to going out of the browser as http://sharepoint.com:8081 so the firewall is blocking. Also I am not sure if the firewall can listen at two difference ports 80 and 8081 for a same url If this is not the right forum please redirect me to a forum where I could get help on this Thanks for taking time Deepak  

Sharepoint site by something other than computer name: port number


I am quite new to sharepoint and like what I see so far, but I am having major problems getting a site by a domain other than http://computername:portnumberto work for me.

For example.  Lets say my computer name is sharepoint server and I want to create a web application and collection by the name of mysite.mysite.com.  The mysite.mysite.com site creates fine and shows up in IIS fine.  I create a host file entry for mysite.mysite.com and point it to my server.  When I try and browse to the site http://mysite.mysite.com I get challenged for authentication.  If I ping the site it is pinging the correct server. I put in the correct username and password, but I am unable to login.  If I create a site that is just the computer name and a random port number I am able to log in.

I figure I am missing something simple, but I have tried to research this for several hours and have gotten no where. Can anyone point me in the right direction?

I would also like to add that I would like to make serveral sites that are running over port 80 by using host headers...if that changes anything.

Getting the name of the process that is using a serial port or file


Sometimes it happens that opening one file or serial port fails because it is used by another process.

Is there a way to get the name of the process that is using it ? 

Thank you

Port number is alredy in use


I try to run my first web application with Web Matrix. When I try to start the application and choose a port number (Application Port), I get the following message:
The specified port number is alredy in use. I have tried with port numbers 80, 8080 and 8088. What is wrong?

Sincerely, Albert.

Why is Sharepiont appending port number to public URL?


I have created an extended web application, so there are two SharePoint applications running on the same server, one on port 80 and the other on port 8081.  Internally everything is fine.

In the extended application I installed the "Help Desk" template.

When I try to access the extended application using the public URL, everything is fine initially, I can browse from site to site, I can browse service requests and other lists, but as soon as I try to access folders that I have created in the "Knowledge Base" SharePoint begins to append port 8081 to the public URL.  For example, let's say that my public URL is www.knowledgebase.com, SharePoint begins to reference www.knowledgebase.com:8081.  Obviously this is not going to work, NAT will not allow it.

I can view documents in the root of the Knowledge Base, and I can upload documents to the root of the Knowledge Base, but as soon as I try to access a sub folder, the URL is wrong because SharePoint is appending the port number and the URL can not be resolved.

I can not find anywhere in the configuration where I have asked SharePoint to do this for me.  What is going on?  This has to be something simple, but I can't seem to track it down, any suggestions would be greatly appreciated.

Also, I am not having this trouble in the application running on

Why is the "System" Process opening and keeping the port open for my .NET remoting framework applica


I'm using Remoting in a .NET 3.5 framework application of mine (running on windows 2008 r2). I'm opening port 8086 with the following code

BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
      serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

      BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
      IDictionary props = new Hashtable();

        props["port"] = 8086
        TcpChannel channel = new TcpChannel(props, clientProv, serverProv);
        ChannelServices.RegisterChannel(channel, false);
          typeof(Remote), "Remote", WellKnownObjectMode.Singleton);
      catch (Exception ex)
        logger.Error("Failed to intialize service remoting: ", ex);

For some reason, when i restart my windows service that has the above code running, it throws an exception saying that "Only one usage of each socket address (protocol/network address/port) is normally permitted". Digging into this a little deaper it turns out that "System" process is holding on to my port and it won't let it go. Even if i kill my process, the "System" process still owns the port.


yahoo smtp and port number.




does any one knw, wht is the smtp name and its port number.............and how to use it in my c# application.




ASP.NET Architecture - ASP.NET Worker Process - HTTP Pipleline - Http Modules and Handlers

"ASP.NET is a powerful platform for building Web applications, that provides a tremendous amount of flexibility and power for building just about any kind of Web application. Most people are familiar only with the high level frameworks like WebForms and WebServices which sit at the very top level of the ASP.NET hierarchy. In this article I'll describe the lower level aspects of ASP.NET and explain how requests move from Web Server to the ASP.NET runtime and then through the ASP.NET Http Pipeline to process requests.

bluetooth print via serial port PDA

Print via BlueTooth using PDA

Convert English to Arabic number without changing any regional settings in .net

Well, most applications that I worked with was multilingual that supports English UI and Arabic UI.

And one of the major issue that we have faced is displaying Arabic numbers without the need of changing the regional settings of the PC.

So the code below will help you to display Arabic number without changing any regional settings.

Parallel port complete: programming, interfacing & using the PC's parallel

Parallel port complete: programming, interfacing & using the PC's parallel

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend