timeout

Socket Timeout in C++ Linux

依然范特西╮ 提交于 2019-12-18 15:53:21
问题 Ok first of all I like to mention what im doing is completely ethical and yes I am port scanning. The program runs fine when the port is open but when I get to a closed socket the program halts for a very long time because there is no time-out clause. Below is the following code int main(){ int err, net; struct hostent *host; struct sockaddr_in sa; sa.sin_family = AF_INET; sa.sin_port = htons(xxxx); sa.sin_addr.s_addr = inet_addr("xxx.xxx.xxx.xxx"); net = socket(AF_INET, SOCK_STREAM, IPPROTO

Apache Http Client prints “[read] I/O error: Read timed out”"

匆匆过客 提交于 2019-12-18 15:29:10
问题 I am using apache http client v4.5 and using it as a REST client. In some cases I recognize an error "[read] I/O error: Read timed out" which comes from the httpclient framework when it reads the received content and shows it as a last message. It seems not to have an impact, however I wonder if somebody has an idea where it is coming from and how it can be solved. According the following thread (link) it seems to be an issue with the "mutlithreaded" configuration. However I use only the

Java: socket read time out exception

跟風遠走 提交于 2019-12-18 14:54:02
问题 I trying to make a call to a very heavy duty process. It's average work length is estimated by 9-10 minutes. When I'm executing the process, I set the timeout for a ridiculously huge number: 99999999. After 2 minutes, I get the following error: java.net.SocketTimeoutException: Read timed out I tried to mess with it some more, and I set the timeout to 3000, and after 3 seconds as anticipated I got the same error. Do you have any idea on why socket.setSoTimeout(99999999) sets it to 120000 max?

Adding timeout to DatagramSocket - receive()

馋奶兔 提交于 2019-12-18 14:12:42
问题 I need to create a 10 second timeout on this part of the code DatagramPacket getack = new DatagramPacket(incoming, incoming.length); socket.receive(getack); I need it to listed for incoming packets for 10s if it receives a packet before 10s it would skip down to if statement in case it reaches 10s it would jump down to else and resend the packet. Is this possible and how could i do this iam pretty new to this. private static void sendDATA() { outgoing = new byte[512]; // Empty array try {

Cancel a AngularJS $timeout on routeChange

谁说胖子不能爱 提交于 2019-12-18 13:53:11
问题 On a specific page in my application I think of doing a server-call to update information on a set interval. I stumbled upon a problem though. I want to cancel my $timeout when a user navigates away from the page in question so that the application doesn't try to work with stuff that isn't there anymore. Any ideas on how to work around this? 回答1: Use $timeout.cancel like this: yourTimer = $timeout(function() { /* ... */ }, 5000); $timeout.cancel(yourTimer); Reference 来源: https://stackoverflow

Using Timeout to avoid deadlock in Java multithreading

无人久伴 提交于 2019-12-18 13:19:14
问题 One of the strategy to avoid deadlock situation in Java Multithreading is using timeout. Suppose, one thread has acquired lock on one resource and now waiting for lock on another resource. After certain time period if it can not acquire lock on resource2 then it should stop waiting for lock on resource2. Also it should release lock on resource1. Thus deadlocks will be avoided. But how to implement it in Java ? How to explicitly "release" lock ? How to define timeout to wait for lock. What is

Need to reduce the timeout period for a route in expressjs

≡放荡痞女 提交于 2019-12-18 13:17:41
问题 Within expressjs is there a way I can set the timeout limit per route. I have some routes that may take 30-45 seconds to process (A large amount of tasks) And then other routes that if it takes longer than 5 seconds I want it to time out. I guess I am asking is there a way to globally set the timeout limit on requests and is there a way to do it individually on routes. 回答1: Use the built-in connect-timeout middleware: http://www.senchalabs.org/connect/timeout.html var connectTimeout = require

QNetworkReply and QNetworkAccessManager timeout in http request

孤街醉人 提交于 2019-12-18 13:01:29
问题 How do I setup a timeout when I do an http request? I have this code: { QNetworkRequest request; request.setUrl(QUrl("http://www.foo.com")); request.setRawHeader("User-Agent", USER_AGENT.toUtf8()); request.setRawHeader("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); request.setRawHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); request.setRawHeader("Accept-Language", "en-us,en;q=0.5"); request.setRawHeader("Connection", "Keep-Alive"); reply = m

Handling timeouts with Node.js and mongodb

爷,独闯天下 提交于 2019-12-18 12:52:23
问题 I am currently testing how some code stands up against the following scenario: Node.js application is started and successfully establishes a connection to mongodb After it has successfully setup a connection, the mongodb server dies and all subsequent requests fail To do this I have got the following code which makes use of the official driver (found here: https://github.com/mongodb/node-mongodb-native) : MongoClient.connect('mongodb://localhost:27017/testdb', function(err, db) { app.get('

Retry a Bash command with timeout

非 Y 不嫁゛ 提交于 2019-12-18 12:44:51
问题 How to retry a bash command until its status is ok or until a timeout is reached? My best shot (I'm looking for something simpler): NEXT_WAIT_TIME=0 COMMAND_STATUS=1 until [ $COMMAND_STATUS -eq 0 || $NEXT_WAIT_TIME -eq 4 ]; do command COMMAND_STATUS=$? sleep $NEXT_WAIT_TIME let NEXT_WAIT_TIME=NEXT_WAIT_TIME+1 done 回答1: You can simplify things a bit by putting command right in the test and doing increments a bit differently. Otherwise the script looks fine: NEXT_WAIT_TIME=0 until command || [