.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

Able to connect to non existing host

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :.NET Framework
I made a little program that connects asynchronously to a host to check if it´s port is open or not: socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) Dim result As IAsyncResult = socket.BeginConnect(IpAddress, port, Nothing, Nothing) Dim isConnected As Boolean = result.AsyncWaitHandle.WaitOne(1000, True) It works just fine, but then this 1 person told me that he never seemed to get an offline notification when the server it´s off.   I sent him a simple test program using the code above that connects to an inexistent host (, and sure enough, he got an "On" message. He says his network works ok. He can play online, navigate webs and so on with no problems at all. I´m out of ideas. Am I doing something wrong in the code? Or is there some explanation to his network behaviour?   Thanks in advance.

View Complete Post

More Related Resource Links

Connect to existing sql 2005 database


Hello There,

I had successfully restored sql 2000 database to sql 2005. It works like charm

Now i am creating a database model in MVC

I follow these steps

Right click on model > ADO.NET entity data model > Generate from database > New connection (Microsoft sql server) > server name > select or enter database name

But no server name AND database name show in both drop down lists. When i mannually enter database name (which exists in sql 2005) then click on TEST CONNECTION. It gives follwoing error

"A network-related or instance-specific error while establishing a connection to sql server. the server was not found or was not accessible. verify that the instance name is correct and that sql server is configured to allow remote connections.

Kindly help me with this


An existing connection was forcibly closed by the remote host


I get this message when I try to launch a report (.rdl) from Windows Sharepoint 2007.  I have followed the steps to integrate SQL 2005 SP2 with Sharepoint 2007.  I can launch the report by navigating to "http://server:880/reportserver/.."  I am using a shared datasource that I created within sharepoint.  Any help would be appreciated.

Remoting from WebService throws: An existing connection was forcibly closed by the remote host

Hello everyone, I have a problem with using .NET remoting from webservice. When using remoting from console application, there is no problem. I suppose problem is somewhere in IIS. My system is Windows Vista. Thank you for any help. Best regards, Jozef

WCF issues sending large data - "An existing connection was forcibly closed by the remote host"

Hi Guys I have posted the following on www.asp.net but thought it might be productive posting here too.I have been pulling my hair out trying to fix an issue with sending data over WCF, I have read pretty much every THREAD on this forum regarding or similar to this issue without any successful solution.  I have a simple data object which has a [DataMember] with a data type of byte[]. I use this to send binary data from my web app as follows: Asp.net MVC website --> WCF Client (Has my Service References) --> My Services (MyServices.svc) --> Business/Data Tier Everything is being executed from within VS 2008 Pro.   Now I have successfully sent data up to 2.2MB, however it fails if i try and send a file such as 2.3MB or larger i get the following exceptions: General Exception Exception rethrown at [0]:    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)   at SoftApp.WCFClient.MyServiceReference.IMyService.Document_Save(DtoDocument dtoDocument, Int32 usercode)   at SoftApp.WCFClient.MyServiceReference.MyServiceClient.Document_Save(DtoDocument dtoDocument, Int32 usercode) in c:\dev\softapp\softapp.wcfclient\service references\myservicereference\refe

Connect to an existing connection manager from within a custom transformation?

I'm developing a custom data flow transformation and have hit a roadblock.  I need to create an ADO connection to one of the connection managers that's defined in the package already.  I can either hardcode the name of the connection manager, or define it as a custom property....the problem I'm having is accessing it at all.  What I've found is that ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager only has the connection managers defined by the component itself, not already existing in the package.  How do I create a connection to a connection manager that's defined at the package level at design time? Thanks

Tell Me it aint so - VS 2010 Express cannot connect to my Host Sql Server

I just bought a new computer, so I decide to install the 2010 Express version of everything.  But I cant make C# connect to my Sql database located at on my on website.  I just connected to it via Mananagement console, so I know its there and working.  I read one posting comment that Im going to have to purchase VS.  If thats true, Im going back to my old version of Visual Studo.

Unable to connect to local host service when a splash screen is show before start the services

Hi all:

I want to show a splash screen before start the local host services, the host can be open without error, however the client (Form1) is not able to connect to the service. Without the splash screen, every thing work fine. Any idea why ?

Here is the code.

Imports System.ServiceModel

<ServiceContract()> _
Public Interface IHelloWorldService
   <OperationContract()> _
   Function SayHello(ByVal name As String) As String
End Interface

Public Class HelloWorldService
   Implements IHelloWorldService

   Public Function SayHello(ByVal name As String) As String Implements IHelloWorldService.SayHello
      Return String.Format("Hello, {0}", name)
   End Function
End Class

Module Module1
   Private host As ServiceHost
   Private frmSplash As Form

   Sub Main()
      AddHandler AppDomain.CurrentDomain.AssemblyLoad, Addres

Connect DataTemplate from resource , to existing class.

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"


<src:CatList x:Key="cat"/>


first Thanks.

Where <sr

Cannot connect new Servers to existing MOSS 2007 SP2 farm


We have Single Server MOSS 2007 SP2 farm with DBA managed database server. We have different web applications running and deployed several solutions (SharePoint Learning Kit, Facet Search, workflow extensions, new themes) in the farm.

Recently we wanted to scale out our farm by adding one WFE and one indexing server. I have installed MOSS 2007 SP2 slipstream in the C drive (default location) of both the new servers. Then before running the SharePoint Product & Technology Configuration Wizard I uninstalled MOSS, restated the servers and reinstalled MOSS 2007 SP2 slipstream in D drive.

I didn't add farm administrators group to the local administrator group of the new servers but I added my own account which is a member of farm administrator group to local administrator group. I didn't add Central Admin Webapp pool identity account (which is a service account) to the local administrator group either. But this service account as well as farm administrators group account has dbcreator & securityadmin privileges in the sql server, both t

WCF async call return a 10054 error: "An existing connection was forcibly closed by the remote host"



I have a WCF consumed by a Windows Mobile 5.0 or above application with .NET Compact Framework 2.0 SP2 and C#.

When the application consume a asynchronous "method" it throws that message. This is also the stackTrace of inner exception:

at System.Net.Sockets.Socket.ReceiveNoCheck()

How do I Host Existing WCF Services in IIS 7?


I have some .svc files, a .dll, and a web.config file. I know that they work because I can add them to a new ASP.net web application and the services start. My problem is that I can't figure out how to start them from IIS. I have followed many tutorials but none of them work. Considering I have all of the files could someone give me the steps to start the services in IIS 7 please?

I have already ensured that IIS is installed, ASP.net stuff is installed, and ran ServiceModelReg.exe


Adding an SP 2010 server to an existing farm. "Failed to connect to the configuration database." dur


I have an existing sp 2010 enterprise server hosting websites and central administration.  I have a seperate sql 2008 r2 server holding the databases.  My goal is to setup another sp 2010 enterprise server to provide redundancy for the websites and central admin.  I believe I am able to accomplish this by adding another web front end to the farm.  On the second server, I install sp 2010, run the config wizard and connect to the config database located on the sql server, however, I am interrupted at step 3 when I am notified of the following:

Failed to connect to the configuration database.
An exception of type System.InvalidOperationException was thrown.  Additional exception information: There was an error encrypting or decrypting credentials. Either a credential update is currently being performed, or you must update the farm account credentials on this server before you can perform this task.
System.InvalidOperationException: There was an error encrypting or decrypting credentials. Either a credential update is currently being performed, or you must update the farm account credentials on this server before you can perform this task.
   at Microsoft.SharePoint.Administration.SPEncryptedString.CheckCredentialLock()
   at Microsoft.SharePoint.Administration.SPManagedAccount.Deploy(SPApplicat

wcf service host by windows service - client cannot connect



i have created a cf service hosted by windows service. the wcf service app.config is

<?xml version="1.0"?>
<!--Copyright (c) Microsoft Corporation.  All Rights Reserved.-->

      <service name="DiscoveyService.WCFDiscoveryService">

An existing connection was forcibly closed by the remote host


I would like some assistance with this. I have a distributed application that uses TCP .NET Remoting for communication between the server and client computers. 

I am pretty sure the issue is network related because the application is currently running at multiple clients, it is running in instances where the UI on the client connects to the server over a TCP port over the internet. In this client's case, they have two sites in two different cities. The main site (where the server is located), the users connecting to the server are working fine. Even I can connect from my office if I connect via a VPN connection to their network. However, the other users from the other town, get the error "An existing connection was forcibly closed by the remote host" and their IT cannot seem to fix this.

Any ideas on how to fix this?

They've already done the following tests:
  • They can ping the server from the other site's computers
  • They can get an open connection when attempting a Telnet session
  • When using a sniffer to monitor the connection, they can see traffic flowing back and forth from the user machine to the server
  • On the firewall they have a

How do i solve the Genuine Channel Operation Exception : cannot connect to remote host "gtcp://null:

I am trying to register my application which uses remoting. When i pass in the needed parameters i get this exception. Can anyone explain me what GTCP is ? How do i register my application with this protocol ?
Shoeb Sayyed

InfoPath 2010 cannot connect to SharePoint 2010

You have installed Office 2010 beta and you are trying to connect to SharePoint 2010 from InfoPath but you get an error

could somebody give me example how I can connect to database only once if I use many models in contr


I use in my ASP.NET MVC application repository pattern and I use in controller for example 3 models:

   namespace MvcApplication1.Controllers  
        public class HomepageController : Controller  
            private IWebsitesRepository _repository_websites = new WebsitesRepository();  
            private IFirmRepository _repository_firm = new FirmRepository();  
            private IPhotosRepository _repository_photos = new PhotosRepository();  

In WebsiteRepozitory, FirmRepository and PhotosRepository classes I have:

Database1Entities _entities = new Database1Entities();

So I have 3 connections to database ? Is it wrong ? How can I solve it ?

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