w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Heroku and NodeJs - MySql Connection lost: The server closed the connection
You already seem to know what is happening; the MySQL server is closing the connection. Many database services, including ClearDB, to do this (ie, close inactive connections). You're going to have to detect the disconnect event, and recreate the connection. There are instructions in the node-mysql documentation for doing this.

Categories : Mysql

Node.js + setInterval = Connection lost: The server closed the connection
Looks like you're keeping an open connection to a remote MySQL server. The remote server is closing the connection after 8 hours of idle connection. So you have two options. Either you send a keepalive request or you disconnect after your initial request and then open the connection again when timer initiates the next event. Keepalive If you want to send a keepalive request, simply setup a select 1 on an interval timer. select 1 is just a simple query that will cause MySQL to return a result of 1 and reset the MySQL server's connection timeout. It would look something like this. function keepalive() { connection.query('select 1', [], function(err, result) { if(err) return console.log(err); // Successul keepalive }); } setInterval(keepalive, 1000*60*5); Pooling Howeve

Categories : Javascript

.NET SQL Server connection being prematurely closed
The simplest thing to do would be to check the connection state and open it if necessary: if(conn.State == ConnectionState.Closed)//Can't quite remember the exact syntax { conn.Open(); } //do DB stuff here.

Categories : Sql Server

When should SQL server connection be closed in a script?
You don't have to do them at all. After header('Location... you should use exit immediately. Open connections are closed when the script exits automatically. You could manually close them and use exit after that, though. You only need to worry about manually closing the connections if you're running out of connections during long-running scripts, but you may have other problems at that point.

Categories : PHP

The underlying connection was closed: The connection was closed unexpectedly wcf service
The first thing i will do is, instead of returning the full list of candidates i will return an empty list. If that works fine, then it is very clear that the size of the data is a problem. To modify the size play with your binding parameters.

Categories : Wcf

determine if client has closed connection to server using socket
Here is some code I believe can be used to detect exiting socket... Originator of this code was stated as Andrew Gillard no other licence information was available... <?php $host = ''; $port = 7010; gc_enable(); set_time_limit(0); function socketError($errorFunction, $die=false) { $errMsg = socket_strerror(socket_last_error()); echo $errorFunction.' '.$errMsg." "; if ($die) die("Program Ended "); } //Attempt to create our socket. The "@" hides PHP's standard error reporting, if (!($server = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) socketError('socket_create', true); //socket_set_option($server, SOL_SOCKET, SO_REUSEADDR, 1); if (!@socket_bind($server, $host, $port)) socketError('socket_bind', true); if (!@socket_listen($server)) socketError('socket_list

Categories : PHP

Fatal: Server unexpectedly closed network connection
The command is working fine for me. However, your question suggests that you're trying to connect to an FTP server. WinSCP can handle both SCP/SFTP and FTP connections, but to my knowledge psftp supports only SFTP (a file transfer protocol based on SSH, not to be confused with FTPS). If your server is not an SSH server, you need an FTP client for the data transfer (e.g. ftp.exe shipped with Windows). If your server is an SSH server, try running psftp with the option -v to get more information, and also check the logs on the server.

Categories : Powershell

Close connection in PHP but keep executing script in live iis server
finally i found answer ...... 1>On the server main page, under "Management", select "Configuration Editor"; 2>under "Section", enter 'system.webServer/handlers'; 3>next to "(Collection)" click "..." OR mark the element "(Collection)" and, under "Actions" und '(Collection)' Element, click "Edit Items"; 4>scroll down until you find your PHP version under "Name"; 5>at the bottom, the Properties are shown an can be edited manually, including responseBufferLimit, which should be set to 0 for flush() to work. just follwing this steps flush is working on iis..my problem is resolve

Categories : PHP

Client prints Half Data Before Connection is Closed By Server on Socket
try flush data after sent. it needs if you use socket with fdopen FILE *fdsock = fdopen(sock, "a+"); ... fwrite(fdsock, 1, 1 "A"); fflush(fdsock); ... fclose(fdsock); and to finish socket, close with shutdown(sock, SD_SEND); UPDATE Take memset out of loop

Categories : C

"The underlying connection was closed: The connection was closed unexpectedly"
The first request does not utilize a header that indicates the length of the result. It closes the connection when it finishes. The second request utilizes the length header, reads the designated number of bytes, then closes the connection gracefully. (under the client side control instead of server driven disconnection) -or- The url you sent caused an error on the server. Is there an error in the server log or event viewer?

Categories : C#

Unplugging causes Adb connection Error:An existing connection was forcibly closed by the remote host
Solution1 run this command: adb uninstall com.yourpackagename Solution2 This is not an answer to solve problem with unplugging. However, if you set android:debuggable="false" in your manifest, then running your android in release mode with the wire plugged in is quite fast. So if you don't switch devices, u don't need to unplug your device then. it is 10x speed up vs running in debug mode.

Categories : Android

ASP.Net Report Viewer- SSRS Express - Unable to read data from the transport connection—The connection was closed
I have resolved this by removing the ReportViewer UI control and we are now creating a pdf of the report using ReportViewer.ServerReport.Render() and opening with Process.Start(). The client only wants a pdf or a print out so we don't need the report viewer as such. I'm not sure why the connection was closed at times, maybe it's network related as I couldn't replicate on a machine located physically next to the server. Either way this is resolved, onto the next project!

Categories : Reporting Services

Windows Phone 8: Updating Live Tile data when app is closed
Does this mean I need to have separate instantiations of this class, one for the main application and the background agent? Yes. You must think of the background agent as a separate application. Though there is ways to share data between your application and your background agent, but the extra complexity isn't worth it in your case. Note that you can share the implementation of your class between the application and the background agent by putting it in a third project (and referencing this project from both the application and the agent).

Categories : Windows Phone 8

Error: Object reference not set to an instance of an object./The connection was not closed. The connection's current state is open
For the first error, your executeScalar() call is returning a null value. Either refine your query - you can check your query by running it directly in your database - or change your logic to deal with null values. For the second error, if calling Open() is throwing that error, it's because the connection object was in use before and was not closed properly. It's usually considered bad practice to reuse connections like that, so consider creating a new connection instance when you go opening one. Edit: I tried to imply something in the second paragraph there, but now I feel I must make it explicit: don't forget to deal with the connection you left open there, as it may be a major performance hog for your application. Specially since it's an ASP.NET one. Dispose of connections as soon as

Categories : C#

How to detect programmatically when other apps are closed / force stopped
I don't believe it's possible to detect when an app is force stopped. Even the app being stopped doesn't get that information. You can detect if an app is currently closed by using the BroadcastReceiver. Here's a pretty decent tutorial on using that: http://saigeethamn.blogspot.com/2009/10/android-developer-tutorial-part-11.html

Categories : Android

How to track down "Connection timout during SSL handshake" and "Connection closed during ssl handshake" errors
This sounds like clients who are going away mid-handshake (TCP RST or timeout). This would be normal at some rate, but 5-10% sounds too high. It's possible it's a certificate issue; I'm not certain exactly how that presents to Things that occur to me: If negotiation is very slow, you'll have more clients drop off. You may have underlying TCP problems which you weren't aware of until your new SSL endpoint proxy started reporting them. Do you see individual hosts that sometimes succeed and sometimes fail? If so, this is unlikely to be a certificate issue. I'm not sure how connections get torn down when a user rejects an untrusted certificate. You can use Wireshark on the HAProxy machine to capture SSL handshakes and parse them (you won't need to decrypt the sessions for handshake anal

Categories : Ssl

.Net SoapClient Connection Was Not Closed
The error occurs in the database connection. Make sure that the SqlConnection object is properly disposed in your server code (a good practice is to wrap your code with using statements).

Categories : Asp Net

How to create apps with live text calculations/processing similar Calca and Taskpaper
You may find NSExpression useful as it can perform several mathematical operations: NSExpression *expression = [NSExpression expressionWithFormat:@"5 - 2**5"]; id value = [expression expressionValueWithObject:nil context:nil];

Categories : IOS

HTTPUrl connection closed automatically
JAXB likely consumes the InputStream and then closes it. You would need to use some kind of FilterInputStream so that it's buffered and reusable. With Guava, you can do something like HttpURLConnection con = ...; // get it InputStream in = con.getInputStream(); String content = CharStreams.toString(new InputStreamReader(in, Charsets.UTF_8)); Then pass a new InputStream to JAXB made from the bytes of content. InputStream inForJAXB = new ByteArrayInputStream(content.getBytes()); You can do the same thing again for any other component that needs the content of the HttpURLConnection input stream.

Categories : Java

Closed connection with ORMLite and MySql
I think this is a FAQ. After a while the server may close a database connection because it has not been used in a while or for some other reason. I talk about the ways to keep a connection open in this answer here: org.hibernate.exception.GenericJDBCException: could not execute query To quote, there are many ways you can work around this problem: You can issue some sort of "keep alive" type of query (ex: SELECT 1) on the connection every so often to keep it alive. This assumes that it got closed because it was idle. You can re-open the connection every so often. If you get a connect closed exception then you can just reopen the connection. Duh. You can use a connection pool which can do the keep-alive and the reconnection for you. Apache's DBCP is a favorite of many. See my

Categories : Mysql

SQLite Connection leaked although everything closed
The bolded font in the citation corresponds to this part in your code: private DatabaseManager open() throws SQLException { dbHelper = new DatabaseHelper(context); db = dbHelper.getWritableDatabase(); from: http://www.androiddesignpatterns.com/2012/05/correctly-managing-your-sqlite-database.html Approach #1: Use an Abstract Factory to Instantiate the SQLiteOpenHelper Declare your database helper as a static instance variable and use the Abstract Factory pattern to guarantee the singleton property. The sample code below should give you a good idea on how to go about designing the DatabaseHelper class correctly. The static factory getInstance method ensures that only one DatabaseHelper will ever exist at any given time. If the mInstance object has not bee

Categories : Android

There is already an open DataReader associated with this Connection which must be closed first. c#
Does the below code help ? foreach (fingerprint fingerPrint in this.db.fingerprints) { using(fingerprint) { DPFP.Template template = new DPFP.Template(); template.DeSerialize(fingerPrint.data); ver.Verify(FeatureSet, template, ref res); if (res.Verified) { employees = fingerPrint.employee; //Im GETTING AN ERROR HERE break; } } }

Categories : C#

Connection is closed error with SqlTransaction
try by opening connection before BeginTransaction using (var con = new SqlConnection(cs)) { con.Open(); SqlTransaction tran = con.BeginTransaction(); // rest of the code

Categories : C#

Vnc viewer:The connection closed unexpectedly
A vnc server is running on a certain "display", that is the :0 :1 :2 ... at the end of the connection string. Obviously yours is running on display 2 (which is TCP port 5902). I would assume there is either no vnc display 4 and your viewer software is giving a slightly missleading error message, or there is something other than a vnc server running on display 4.

Categories : Unix

Dynamically edit multiple choice options in live Google Form using Apps Script
I believe we can achieve your second objective without too much difficulty and modify the form, based on the current state of response. The approach is to Create the form and associate it with a response spreadsheet In that response spreadsheet, create a script with a function (updateForm for instance) Bind that function with the onFormSubmit event, see Using Container-Specific Installable Triggers. Analyse the response in the updateForm function and modify your form using the Form Service For instance function updateForm(e) { if (e.values[1] == 'Yes') { Logger.log('Yes'); var existingForm = FormApp.openById('1jYHXD0TBYoKoRUI1mhY4j....yLWGE2vAm_Ux7Twk61c'); Logger.log(existingForm); var item = existingForm.addMultipleChoiceItem(); item.setTitle('Do you prefer c

Categories : Google Apps Script

Rails 4 - Live, connection keeps going on even after refresh
So if you were doing that logic in a thread you created yourself, my answer would be, wrap everything in: def events ActiveRecord::Base.connection_pool.with_connection do response.headers[etc #.. end end Now, you are not making your own thread. Based on your symptoms, I suspect that may solve your problem anyway, it would be interesting to see. However, it probably shouldn't be necessary since ActionController::Live is an official supported part of Rails, and the documentation and examples do not say you should have to do the with_connection thing. I am not familiar with ActionController::Live myself; it sounds like it might possibly be a bug. You might want to file with Rails issue tracker, after creating an as-small-as-possible application that demonstrates the problem.

Categories : Ruby On Rails

telnet Connection closed when I use yield in diesel
Maybe something like this. It mightn't work straight away as I am unfamiliar with how diesel works. import StringIO import socket import threading from diesel import Application, Service, until_eol, fire, wait class socket_thread(threading.Thread): def __init__(self, line_filter = None): threading.Thread.__init__(self) self.daemon = True self.lock = threading.Lock() self.event = threading.Event() self.event.clear() self.buffer = StringIO.StringIO() if(line_filter == None): self.line_filter = lambda x: x else: self.line_filter = line_filter def run(self): message = True while message: message = diesel.until_eol() self.lock.acquire() self.b

Categories : Python

Python 2: SMTPServerDisconnected: Connection unexpectedly closed
Most probably the gmail server rejected the connection after the data command (very nasty of them to do so at this stage :). The actual message is most probably this one: retcode (421); Msg: 4.7.0 [ip.octets.listed.here 15] Our system has detected an unusual rate of 4.7.0 unsolicited mail originating from your IP address. To protect our 4.7.0 users from spam, mail sent from your IP address has been temporarily 4.7.0 rate limited. Please visit 4.7.0 https://support.google.com/mail/answer/81126 to review our Bulk Email 4.7.0 Senders Guidelines. qa9si9093954wjc.138 - gsmtp How do I know that? Because I've tried it :) with the s.set_debuglevel(1), which prints the SMTP conversation and you can see firsthand what's the issue. You've got two options here: Cont

Categories : Python

Underlying connection closed error in WCF client
WCF is a message-based system using XML-serialized messages to communicate between client and server. This means that WCF messages have to be in such a way that they can be expressed in a XML schema and thus packaged up into a XML message. WCF is not a remote procedure call system, e.g. there is no "live" connection at runtime between the client calling the server - the client just send a request as an XML message to the server, and the server responds by sending back another XML message containing the response. This also means: you can only use explicit concrete types - no interfaces. And it also means: no generics. So IEnumerable<VehicleTypes> is not good for two reasons: generics and interfaces. You will need to create a VehicleCollection type on your server-side, and use that

Categories : Asp Net Mvc

PDO connection is not closed when phpunit is running with symfony 2.X
Did you check your phpunit.xml.dist file? I think you should look at this; http://www.slideshare.net/fabpot/unit-and-functional-testing-with-symfony2 Be sure your parameters are the same below <phpunit backupGlobals = "false" backupStaticAttributes = "false" colors = "true" convertErrorsToExceptions = "true" convertNoticesToExceptions = "true" convertWarningsToExceptions = "true" processIsolation = "true" stopOnFailure = "false" syntaxCheck = "false" bootstrap = "bootstrap.php.cache" >

Categories : Symfony2

Connection closed before request completed - Android ION
If you don't mind checking, I think the underlying cause of this bug was fixed recently: https://github.com/koush/ion/issues/18 https://github.com/koush/AndroidAsync/issues/55 Was related to SSL.

Categories : Android

HttpClient Connection closed in between while data is transferring
finally solved the issue, setting the following header worked for me. method.setRequestHeader("Accept-Encoding", "gzip, deflate"); and postResponse = IOUtils.toString(new GZIPInputStream(method.getResponseBodyAsStream()));

Categories : Java

Socket Connection getting closed after serving client in perl
You can find working example of INET/TCP socket server in perlipc(1) man page. I prefer using IO::Socket standard as described here. If you don't want to use the IO::Socket module, you have working example here. Server sample code from this manual: #!/usr/bin/perl -w use IO::Socket; use Net::hostent; # for OOish version of gethostbyaddr $PORT = 9000; # pick something not in use $server = IO::Socket::INET->new( Proto => "tcp", LocalPort => $PORT, Listen => SOMAXCONN, Reuse => 1); die "can't setup server" unless $server; print "[Server $0 accepting clients] "; while ($client = $server->accept()) { $client->autoflush(1); print

Categories : Perl

An existing connection was forcibly closed by the remote host on WCF
"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host." This error could be generated because of Group Policy Settings. Try connecting to Analysis Service using SQL Management Studio, if error persist try to elevate the user privilages.

Categories : Wcf

Python Redis connection should be closed on every request? (flask)
By default redis-py uses connection pooling. The github wiki says: Behind the scenes, redis-py uses a connection pool to manage connections to a Redis server. By default, each Redis instance you create will in turn create its own connection pool. This means that for most applications and assuming your redis server is on the same computer as your flask app, its unlikely that "opening a connection" for each request is going to cause any performance issues. The creator of Redis Py has suggested this approach: a. create a global redis client instance and have your code use that. b. create a global connection pool and pass that to various redis instances throughout your code. Additionally, if you have a lot of instructions to execute at any one time then it may be worth having

Categories : Python

Getting FTP working on an Azure VM, overcoming 'connection closed' on ftp client
A colleague suggested investigating SSL so I deleted the FTP site and started again building a new one. The new ftp site worked. Staring at the config screens for the new FTP site in the IIS Manager I have a suspicion that the binding on the old site was incorrectly specifying as the IP Address instead of All Unassigned (i.e. *)

Categories : Iis

"An existing connection was forcibly closed by the remote host" in eclipse
Check to see if you have two versions of adb installed. Eclipse installs one and perhaps HTC Sync installed another. They might be different versions. You'll have to do some path trickery to get both apps to use the same version of adb. You can search for ADB in your path by entering the following in a command prompt: where adb.exe

Categories : Android

Bash script with telnet "connection closed by foreign host"
Your box may have access restrictions that make it disallow connections from the machine you're running the script on. As general advice: do quote $line to prevent nasty things from happening, as in: echo 'foo'"$list"'bar' (notice the double quotes); instead of telnet, which is meant more for interactive usage, use nc (netcat): echo 'stuff' | nc -n 49153; this may help with your connection issues, if your telnet is trying to be smart and negociate telnet protocol specific parameters before it sends your data through; since you only use one command, echo, to send data, you don't need to run it in a subshell, so the parentheses ( ) are not needed; when you have multiple lines to output, consider using cat <<EOF instead of echo (look up here-documents in the bash manual)

Categories : Bash

The underlying connection was closed: An unexpected error occurred on a receive. while Using WCF
First of all check your web.config setting for executionTimeout and maxRequestLength on both side WCF and your MVC4 client. for more information on this please refer this below link there is a good answer given by jlchereau, follow this steps and try to check it out again, it might help you out. also try to enable WCF tracing (Tracing) and find out the root of exception it will help you a lot to resolve your issue. http://velodocaddin.codeplex.com/discussions/40792

Categories : Wcf

UDP Socket: An existing connection was forcibly closed by the remote host
In BeginReceiveFrom your remoteEP should indentify the socket that is listening, mostly the same endpoint that you have used for the Bind. And in your callback method ReceiveCallbackUDP you should call EndReceiveFrom, as this is the corresponding Method to BeginReceiveFrom: EndPoint tempRemoteEP = (EndPoint)client.remoteEndpoint; int bytesRead = UDPSocket.EndReceiveFrom(ar, ref tempRemoteEP); See the Example in http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.beginreceivefrom.aspx, where tempRemoteEP passed to BeginReceiveFrom is the same Endpoint as sender passed to Bind.

Categories : C#

© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.