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

Top 5 Contributors of the Month
Post New Web Links

Making a socket connection through a proxy.

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :.NET Framework


I've got an application in test where I create an internet socket that connects to a service over the inernet and receives a stream that I translte to XML files. So far so good. Now I'm told I need to be able to do this through a proxy server and am stumped. What am I missing, how do I do this? Thanks!


View Complete Post

More Related Resource Links

problem in socket connection

I had client and Server application, the server application to listern an a particular port. 500 clients are to connected and send the data to process everything fine.  At particular time i closed all clients and also close the server. when i start server after 10 mins at before 2 mins start all clients, very few clients(5-15) are connected. give me a solutiion.

The socket connection was aborted Exception


Hi All,

whenI use wcf, the client recorded the exception below.

if server and client deploy same computer the exception can't occur.

if server and client deploy different computer the exception can occur.

The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '01:40:29.2170000'.

I am perttymuch sure tat its not because of time out. I have given the config like this in client side and service side


NetTcpBinding tcpBinding = new NetTcpBinding();

tcpBinding.SendTimeout =

First WCF Connection Slow and Proxy Settings in app.config file


I'm new to the WCF and currently facing problems with my first connection to a service we created to connect an Excel OBA to SAP. The first connection is extremely slow, approximately 20 seconds, but once it is establish everything goes really quick afterwards. I've read through some posts and seems like the proxy settings could have an impact. I'm pasting the code of my app.config file below, can you please let me know how I should modify it to include proper proxy settings to improve the first connection?

Also, the proxy thing is just a guess, is there anything else I could do to improve this? Any hint would be appreciated.

Thanks a lot!






xml version

How to handle the socket connection was aborted communication exception.....


Hi All,

I keep getting the following exception and I would want to know how I can handle this. I am using NET TCP BINDING.

<Message>The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '10675199.02:48:05.4775807'.

Exception Detail:

System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '10675199.02:48:05.4775807'. ---&gt; System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

--- End of inner exception stack trace ---

at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)

at System.ServiceModel.Channels.FramingDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message&amp; message)

at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext&amp; requestContext)

at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext&amp; requestContext)


Socket Connection Error


Hi All,

Am using socket connection to send and receive values. The following code is used to receive response.

  while ((sizeReceived = skt.Receive(bytesReceived, bytesReceived.Length, SocketFlags.None)) > 0)
                       nTotalBytes += sizeReceived;
                       sCleanresponse += Encoding.ASCII.GetString(bytesReceived, 0, sizeReceived);
                       //Giving time to read the remaining amount
                       if (skt.Available > 0)

In the above code, am facing a prob in skt.Available. If i dont give the thread.sleep, it is not repeating the while loop and it exits after onetime. And if i dont give skt.Available line, sometimes it throws socket Exception. I do not want to use thread.sleep. Does anyone knows why this is happening and how can i resolve this? 

CommunicationException: The socket connection was aborted


I have a .NET 4.0 WCF service (Net.TCP) hosted in IIS 7.5.  Every once in a while I see Socket related errors on the server.  Is this a timeout issue?  How can I prevent this from happening?   


//This is the outer exception

TypeName: System.ServiceModel.CommunicationException

TypeAssembly: System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089

Message: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:10'.

Source: System.ServiceModel

TargetSite: Int32 ReadCore(Byte[], Int32, Int32, System.TimeSpan, Boolean)

StackTrace:    at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)

   at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)

   at System.ServiceModel.Channels.PreReadConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)

   at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)


Wsdl genereated proxy getting error "The underlying connection was closed: An unexpected error occur


Created a server interface proxy with wsdl.exe and added the /ServiceInterface attribute.  When consuming the web service on the development machine I receive this error, "The underlying connection was closed: An unexpected error occurred on a receive"


Pat Luciano

App to Support WebService and Socket Connection



I have a scenario at my hand where in I have to build a WebApp/Control for implemeting the following two scenarios:

1. The Server app will be accesed by a device and based on the logic,  an XML is returned to the calling device. My solution is to implement a WebService for this.

2. The App also needs to communicate with another device for transfering the images, videos, audio, etc to the server app. The requirement from the client (who himself has a bit of Technically knowledge) end is to do it using the Sockets.


I am not sure if the same can be bundled into the same app. But have to do it somehow.

Any sort of inputs will be highly appreciated.



Sumit Bhatnagar

Cheers!! Sumit Bhatnagar

Setup to access moss 2007 externally when a proxy server is enabled on the internet connection



Does anyone know what setup is required to allow an internet connection with a proxy server enabled to authenticate properly with moss 2007?

The credentials dont get accepted at the moment and the screen goes blank (white) after the three attempts. I gather this has something to do with NTLM not being allowed throguh the proxy server which is the authentication method we have used at the moment.


Socket Connection Is Actively Refused

I have a server application written is C/C++ that finds an available port, creates a socket, and starts listening.  The server posts its IP Address and port to a database so that clients can connect to the server.  I have a Client application written in C/C++ that has no problem connecting to this server; however, I am rewriting that client application in C# and I cannot get the client to connect to the server.  I consistently receive a "No connection could be made because the target machine actively refused it" exception.  I have stepped through the code and the IP Address and port look correct to me.  I don't think this is a firewall problem since my other client is able to connect and I have tried my new client with the firewall disabled.  The server is using verson 2.0 sockets.  Below is the code I am using in my C# client to try to connect to my server.
// Create an IP Address from the data read from the DB

Making Ajax Callbacks to the Server Using jQuery with ASP.NET

In the first part of this article series I introduced jQuery's functionality and how it provides a rich client side programming model. This time around I'll expand on these concepts and show you how you can use jQuery in combination with ASP.NET using it as an AJAX backend to retrieve data. I'll also discuss how you can create ASP.NET controls and otherwise interact with jQuery content from ASP.NET pages in WebForms.

jQuery is just a JavaScript library so it will work seamlessly with ASP.NET both from page code as well as through backend driven code using the Page.ClientScript object or ScriptManager. You can use jQuery on its own as a client side and Ajax library that communicates with ASP.NET or you can use jQuery in combination with ASP.NET AJAX. The two actually complement each other quite well as jQuery provides functionality that the ASP.NET AJAX library does not and vice versa. For the most part the interaction between the two libraries is trouble free except for a few very rare edge cases.

SQL Connection String

We can learn or know how can we connect the database from our .net. This will help for freshers or .NET beginners!

Making Sense of ASP.NET Paths

ASP.Net includes quite a plethora of properties to retrieve path information about the current request, control and application. There's a ton of information available about paths on the Request object, some of it appearing to overlap and some of it buried several levels down, and it can be confusing to find just the right path that you are looking for.

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.

Problem making Role based Menu in MVC application



 I want to make Rolebase menu in MVC such that if user doesnot have permission for some action then that Action name shouldnot be shown in the Menu.

 I have used the code in the url(http://forums.asp.net/t/1566328.aspx) in my MVC application.My application is a Discussion Forum(in MVC) same functionality as in this forum forums.asp.net

 I have used Controllers for post, thread etc.In each controller there are some actions that are using [Authorize(Roles)] attribute

 but this coding does not count  those Actions in Controllers having Authorize attribute according to the url http://forums.asp.net/t/1566328.aspx 

 In the code, Authorize attribute is applied to Controller class, but my requirement is of Applying Authorize attribute to some actions in controller so that some are available for all users and  some links are available rolewise.Now what is the solution for that?



connection string question from a newbie


when publishing  in the webmatrix dialogue it asks for "destination connection string" for my "database.mdf"

I was not sure what it was so I pasted this from my web.config file :

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\database.mdf;Integrated Security=True;User Instance=True

it all published ok, but wont run, so I guess it has somthing to do with this connection string or some kind of configuration issue.

My question is this, What should go in the field for "Destination connection string"

deploying to msdeploy does not support a proxy server


I am trying to deploy through webmatrix but my system Proxy server configuration is not being used. I assume that webmatrix would detect the proxy server settings and use that for the msdeploy calls under the hood. Can anyone confirm this is a know issue? 

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