w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
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

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

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

Connection Reset by Peer with Python module urllib
If you don't know the exact problem, you can catch all exceptions as so: try: urllib.request.urlretrieve(myUrl['link'],str(count)+'.jpg') except URLError as e: print(e.reason) except KeyboardInterrupt as ki: raise ki except: print("Unknown Error")

Categories : Python

Can I change the connection pool size for Python's "requests" module?
This should do the trick: import requests sess = requests.Session() adapter = requests.adapters.HTTPAdapter(pool_connections=100, pool_maxsize=100) sess.mount('http://', adapter) resp = sess.get("/mypage")

Categories : Python

How can I make a connection between Raspberry Pi and a Bluegiga WT11i Bluetooth Module using Python?
Got it!! pi@raspberrypi ~ $ aptitude install bluetooth pi@raspberrypi ~ $ hcitool dev Devices: hci0 00:07:80:54:CA:E2 pi@raspberrypi ~ $ hcitool scan Scanning ... 00:07:80:54:CA:E2 BGWT11i pi@raspberrypi ~ $ bluez-simple-agent hci0 00:07:80:54:CA:E2 Enter PIN Code: 1234 Now I can connect ... pi@raspberrypi ~ $ python rfcomm-client.py 00:07:80:54:CA:E2

Categories : Python

"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

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

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

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

ImportError: No module named transport (Paramiko, Python 3.2.5)
It appears Paramiko is trying a relative import, which is not recognised in this form in Python 3 anymore. See the changes in Python 3. The import statements in Paramiko should be one of from .transport import SecurityOptions, Transport (note the leading dot), or from paramiko.transport import SecurityOptions, Transport You can either fix the paramiko source code, or as a workaround, you could add /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/paramiko to your PYTHONPATH. Neither are preferred. Did you run the 2to3 tool before you ran python3 setup.py install? I'm not sure if that would fix this though, since the tool probably can't distinguish between a relative or absolute import in the way it is used here. Do check on the Paramiko forums (if there

Categories : Python

How to properly handle connection persistent things within node-mysql connection pooling
All transactions will happen in the context of a single connection. After you end or terminate the connection, you can no longer operate on that transaction. The general pattern is to open, query, close and unless you have a long running transaction, you won't have any problems of queries or variables bleeding over into other connections. In the event of a long running transaction, you will have to manage that connection object to make sure it exists and is only used by code that operates within that transaction.

Categories : Mysql

paramiko allows sftp connection without key
It looks like this is an acceptable practice. Comment from Transport.connect ''' Negotiate an SSH2 session, and optionally verify the server's host key and authenticate using a password or private key. This is a shortcut for L{start_client}, L{get_remote_server_key}, and L{Transport.auth_password} or L{Transport.auth_publickey}. Use those methods if you want more control. You can use this method immediately after creating a Transport to negotiate encryption with a server. If it fails, an exception will be thrown. On success, the method will return cleanly, and an encrypted session exists. You may immediately call L{open_channel} or L{open_session} to get a L{Channel} object, which is used for data transfer. @note: If you fail to supply a password or private key, this method ma

Categories : Python

how is connection to oracle established?
The listener listens to the listener port. There it accepts a connection, checks the CONNECT_DATA and decides to hand over the session to the specified ORACLE_SID or ORACLE_SERVICE, if that is registered with the listener. The hand over normally is to a different process and a different port. This port number is returned to the client and the client will communicate to the ORACLE process using that port. In a RAC system, the host can be a different one too. If load balancing is enabled the session is routed to the least loaded instance and that can be on a different host than where the original request landed. If the listener is down, new connection can not be made but existing session can be used.

Categories : Oracle

How to check if the web connection is established?
Maybe you can try the fopen() function in php. as described in the php.net fopen() -- "If filename is of the form "scheme://...", it is assumed to be a URL and PHP will search for a protocol handler (also known as a wrapper) for that scheme."... example could be: @$connection = fopen("http://iewuhf.com/", "r"); //note @ is used to suppress the error ortherwise, if connection fails, a warning //will be displayed if(!$connection){ echo 'false'; }else{ echo 'true'; }

Categories : PHP

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 properly keep a DB connection from a Connection Pool opened in JBoss
How do I properly keep my connection opened? You must not do that, let the connection pool handle this. Behind the scenes, the connection pool will keep a bunch of database connections to the database engine (MySQL, Oracle, SQL Server... depends how you configure it) in SLEEPING state. When you execute this code: //avoiding all the particular exceptions just for code simplicity purposes... //in real world applications, you must handle each of these exceptions public Connection getConnection() throws Exception { ctx = new InitialContext(); ds1 = (javax.sql.DataSource) ctx.lookup(strDSName1); return ds1.getConnection(); } You're asking to the connection pool to retrieve one of these connections available. The connection pool will give you a database connection (if avai

Categories : Java

why client connections appear as established when connection is not accepted yet
Because the connection is established. Calling accept() isn't a pre-requisite for that. The system accepts incoming connections and enqueues them to the backlog queue. Calling accept() just removes an item from the queue, blocking while it is empty.

Categories : Java

Forwarding an established TCP connection to another process on another port?
This problem has a pre-existing standard solution, generically known as inetd. It has been around for a long time, first in Unix systems and then Linux. The more modern implementation is xinetd

Categories : C

serversocket.accept() method blocks even after connection is established
Take a look on your code: while (true) { System.out.println("waiting for conn.."); Socket accept = ss.accept(); ................. } You call ss.accept() into infinite loop. Once your client is connected accept() returns the Socket instance. Then you pass this socket to server helper running in its own thread and return to ss.accept(), so your server is ready to accept other clients. Your code looks OK. Unfortunately you have not sent code of your ServerHelper and did not explain whether your client successfully sends data to server, however so far everything looks fine.

Categories : Java

phpseclib: how to give IF condition to check connection established or not
The answer you're looking for is: It's already all there in the example you've given, no need to modify the code. $ssh->login() does exactly what you want: It tries to connect AND login to the server you've given it, and it will return false in case that failed.

Categories : PHP

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

A connection was successfully established with the server, but then an error occurred during the pre-login
On the IIS server, I believe the certificate may need to be installed. http://social.technet.microsoft.com/Forums/forefront/en-US/12c4febb-18e7-4a77-a23e-a615b3913e67/problem-of-certificate-chain-was-issued-by-an-authority-that-is-not-trusted-i-have-imported-the

Categories : Asp Net

How to resume Socket connection on another page?
Another topic with similar problem: How to maintain a WebSockets connection between pages? I'm currently working with same implemation and I did overcome this problem on the server side code having user class that have list of connections that belongs to that user. First client will connect to the server, after that client will register itself using username and given random hash(Extra security against phishing) and the server uses this information to determite who is this client. And when logging out send destroy command also to websocket server so it knows to destroy this user from memory.

Categories : PHP

Right way to do TCP connection between python and Qt?
When a TCP connection is broken by the remote peer, your TCP socket will become ready-for-read, and then when you try to recv() from it, recv() will return 0. Of course if your sending program is only calling send() (the way your Python program is), then it won't notice what's going on with the socket's recv-side, and you end up with the problem you described. On the other hand, you don't want to just blindly call recv() either, because if recv() is called and the remote peer hasn't sent any data, recv() will block waiting for data and unless the remote peer ever actually sends some, you'll have a deadlock. The simplest way to deal with that is to use select() to multiplex your I/O, so that your Python script can know when it's appropriate to call send() and/or recv(). Something like t

Categories : Python

Resume file Upload to wcf rest service when connection fails
I've just implemented something like this. If the upload fails or only half the bytes arrive at the host, what do you do? Our approach was to create two additional methods, one that the client device calls to check the status of the prior upload (called "GetStatusOfLastUpload(SessionID, DeviceID, FileID)") and another called ResumeUpload(SessionID, DeviceID, FileID, MD5Hash, Bytes). The function GetStatusOfLastUpload does what the name implies, sending an additional request to the host to check the status (stored on a SQL database) of a prior upload. Key to this process is using a calculated MD5 Hash and byte counts to determine on the host side if the complete file was delivered. For example, if the client sends 1MB, but the Host only gets 500KB and the MD5 hash sent from the client

Categories : Wcf

SQLAlchemy with on connection (python)
Here is a quote from docs: Most web frameworks include infrastructure to establish a single Session, associated with the request, which is correctly constructed and torn down corresponding torn down at the end of a request. Such infrastructure pieces include products such as Flask-SQLAlchemy, for usage in conjunction with the Flask web framework, and Zope-SQLAlchemy, for usage in conjunction with the Pyramid and Zope frameworks. SQLAlchemy strongly recommends that these products be used as available. In those situations where integration libraries are not available, SQLAlchemy includes its own “helper” class known as scoped_session. So, looks like scoped_session is what you are talking about. Documentation on how to use scoped sessions is pretty good. Basical

Categories : Python

Python close tcp connection
A bad file descriptor, most likely, means that the socket was already closed by another thread. Here are some thoughts on general practices. For the client, one way to know that it is disconnected is to check if the recv() value is 0. If it is, then that means the remote side has closed the connection. Basically, you should use select (or poll) and pass fds of all the clients and teh server to select. If you get a read event on any of the fds, then depending upon the fd type, here is what happens. If the fd is server type, then a read event means that there is a pending connection and you should issue an accept() to get the new connection. On the other hand, if hte fd is a non-server type (meaning a regular tcp connection), then a read event means that there is some data and you should

Categories : Python

How can I resume connection between SQL Server and physical files after hard disk disabling?
Lets start saying that you are in a very bad shape and you should check your physical server ASAP. IMO, the best thing to do is backup the files as-is just in case you can't do anything else then one of the following options restart SQL Server service delete the broken database restore restore back ups to the latest transaction point If the above is impossible. restart SQL Server service hope that things will work

Categories : Dotnet

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. TCP provider, error: 0
Did you uninstall VS 2012 to "fix" this issue? Why can't you install .NET 4.5 on the server or copy the DLLs to the server per Marc Gravell's post at http://marcgravell.blogspot.co.nz/2012/09/iterator-blocks-missing-methods-and-net.html?

Categories : Asp Net

what is the server for jira-python connection?
The problems might comes from the fact that you are using a secure connection to your jira instance. You need to setup a proper certificate for your connection or simply disable certificate verification. See jira.client.JIRA options and set verify to False as such: jira = JIRA(options={'server': 'https://bugs.company.com', 'verify': False}) Are you setting the proper username and password? Finally, you might want to check with your IT department for the proper url.

Categories : Python

Python Socket connection class
You should look at the python documentation to understand how classes and methods work. The biggest difference between python methods and methods in most other languages is the addition of the "self" tag. The self represents the instance that a method is called against and is automatically fed in by the python system. So: class TCPClient(): def __init__(self, host, port, retryAttempts=10 ): #this is the constructor that takes in host and port. retryAttempts is given # a default value but can also be fed in. self.host = host self.port = port self.retryAttempts = retryAttempts self.socket = None def connect(self, attempt=0): if attempts<self.retryAttempts: #put connecting code here if connectionFailed:

Categories : Python

Python: checking internet connection (more than once)
This is how I used to check my connectivity for one of my applications. import httplib import socket test_con_url = "www.google.com" # For connection testing test_con_resouce = "/intl/en/policies/privacy/" # may change in future test_con = httplib.HTTPConnection(test_con_url) # create a connection try: test_con.request("GET", test_con_resouce) # do a GET request response = test_con.getresponse() except httplib.ResponseNotReady as e: print "Improper connection state" except socket.gaierror as e: print "Not connected" else: print "Connected" test_con.close() I tested the code enabling/disabling my LAN connection repeatedly and it works.

Categories : Python

Python Create a VPN connection for just a host
What you want is not a VPN, is an IP port forward, a proxy: http://voorloopnul.com/blog/a-python-proxy-in-less-than-100-lines-of-code/ If need a secure connection between 2 hosts you could use a SSH port forward: http://www.debianadmin.com/howto-use-ssh-local-and-remote-port-forwarding.html

Categories : Python

how to identify connection error in python?
Standard logic in python is to catch exceptions using try/except construction: Handling Exception in Python

Categories : Python

Python script to create SSH connection
For querying EC2 resources, use the boto library. For running the ssh, use the subprocess.call (no need to end the script though). import subprocess addr = '10.20.30.40' subprocess.call([ 'ssh', addr ])

Categories : Python

Python VCenter API connection string
For now i found only way to put password under file system into .cf file and restrict permissions for read on that file. Sure there should be some better way. @classmethod def setUpClass(cls): config_path = os.path.join(os.path.dirname(__file__), "config_conn.cf") cls.config = ConfigParser.ConfigParser() cls.config.read(config_path) host = cls.config.get("READ_ONLY_ENV", "host") user = cls.config.get("READ_ONLY_ENV", "user") pswd = cls.config.get("READ_ONLY_ENV", "password") cls.server = VIServer() cls.server.connect(host, user, pswd)

Categories : Python

How to close a mongodb python connection?
Use close() method on your MongoClient instance: client = pymongo.MongoClient() # some code here client.close() close() is an alias for disconnect() method: Disconnecting will close all underlying sockets in the connection pool. If this instance is used again it will be automatically re-opened.

Categories : Python

Is it possible for a MongoDB connection to timeout in Python?
Citing from Pymongo documentation: http://api.mongodb.org/python/current/api/pymongo/mongo_client.html#pymongo.mongo_client.MongoClient The resultant client object has connection-pooling built in. It also performs auto-reconnection when necessary. If an operation fails because of a connection error, ConnectionFailure is raised. If auto-reconnection will be performed, AutoReconnect will be raised. Application code should handle this exception (recognizing that the operation failed) and then continue to execute. So as @james-wahlin suggested in comments, you should not solely rely on pymongo's connection-pooling mechanism but always wrap your usage of self.db in try..except clauses. Hope this helps.

Categories : Python



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