ECONNREFUSED用于从localhost到另一个localhost的代理请求

To begin, I'm new to angular and I'm following a tutorial video step by step. I've been stuck on this issue for nearly 2 weeks and have spent many hours looking for solutions in other similar forums. I realize this is a common error, but after trying a couple dozen or so solutions but finding no success I figure I may as well post my experience and maybe it can shed some light on this problem many of us seem to be having.

The Issue

The error occurs while following along for the "Angular Tutorial #13" part of the video which starts around 1:42:00. I follow all steps exactly as shown in the video but I encounter the following error message in the terminal in which I run "npm start" :
[HPM] Error occurred while trying to proxy request /api/file.php from localhost:4200 to http://localhost:1234 (ECONNREFUSED)
My package.json scripts for "start": "ng serve --proxy-config proxyconfig.json" and my proxyconfig.json contains:

{
    "/api":{
        "target": "http://localhost:1234",
        "secure": false,
        "changeOrigin": true
    }
}

In CMD I navigate to the folder "intro2angular" which is the root of "/test/api/file.php" and I run
php -S localhost:1234 prior to running npm start in the powershell in VisualStudioCode. Then I run npm start. Code compiles successfully. In Chrome, if I go to http://localhost:1234/test/api/file.php then the file is displayed in the browser. However, if I go to http://localhost:4200 and click an anchor which executes the code to request file.php then the [HPM] Error occurred while trying to proxy request /api/file.php from localhost:4200 to http://localhost:1234 (ECONNREFUSED) error is displayed in terminal. In the Network tab of Developer Tools in Chrome, when I check the Headers for file.php I see the follow:

Request URL: http://localhost:4200/api/file.php
Request Method: GET
Status Code: 504 Gateway Timeout
Remote Address: 127.0.0.1:4200
Referrer Policy: no-referrer-when-downgrade

Forgive me for being verbose in explaining every step I followed, but since I've seen several similar forum posts regarding the ECONNREFUSED error being raised while trying to use a proxy, I thought that including every minor detail may be necessary to distinguish the source of the error in this instance. If any more details/code is necessary I'm more than happy to include it.

Solutions I've tried thus far

Note that this is not a complete list, I've tried several other solutions but these seem to be the most common which have worked for others. Also, I'm not saying that I wouldn't give these solutions another try as I am open to any and all suggestions.

  1. specifying random localhost ports for both the angular app and file.php
  2. using setTimeout to add a delay to the .getData() function call
  3. disabling firewall
  4. including the option "pathRewrite": {"^/api" : ""} to proxyconfig.json

I appreciate any and all help/suggestions/discussions around this issue as I've had no success on my own and I am unable to continue with the angular tutorial until this issue is resolved. Thank you in advance.

duanji5746
duanji5746 我有同样的问题。你找到了解决方案吗?
一年多之前 回复

1个回答



我遇到了同样的问题并且搜索了多年的解决方案... </ p>

在我的 如果它有助于提供localhost的IP,而不是“localhost”。</ p>

所以将您的proxy-config更改为:</ p>

   {
“/ api”:{
“target”:“http://127.0.0.1:1234",
”secure“:false,
”changeOrigin“:true
}
}
</ code> </ pre>

并尝试使用“ng serve --proxy-config proxyconfig.json”而不是npm start版本。 我读到有时候有些人忽略了package.json配置部分。</ p>

希望这会有所帮助!</ p>
</ div>

展开原文

原文

I had the same problem and searched for a solution for ages...

In my case it helped to provide the IP of localhost, instead of "localhost".

So change your proxy-config to this:

{
    "/api":{
        "target": "http://127.0.0.1:1234",
        "secure": false,
        "changeOrigin": true
    }
}

And also try using "ng serve --proxy-config proxyconfig.json" instead of the npm start version. I read that sometimes the package.json config-part got ignored for some people.

Hope this helps!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Python+OpenCV计算机视觉

Python+OpenCV计算机视觉

ssm项目,用postman访问某个后端接口,用localhost能访问,127.0.0.1和本机ip都访问不了

只有这一个接口是这样,其他的用上面三种方式都能访问...求帮助

android 访问网络 拒绝连接

java.net.ConnectException: failed to connect to /192.168.10.98 (port 8080) after 90000ms: isConnected failed: ECONNREFUSED (Connection refused) 第一次 打开应用的时候可以一直访问网络,只要是把Service 后台服务停了 在打开服务就报错! 点击一下住页面,就又可以访问网络,怎么解决呢? 在后台运行久了 也是不能访问网络,次数判断 网络为 true 类型为wifi 联网的代码是写在 Service里面的一个线程里面了

create-react-app 与 firebase 项目设置了proxy还报错[HPM] Error occurred while trying to proxy request / from localhost:3000 to https://asia-east2-socialape-d6344.cloudfunctions.net/api (ETIMEDOUT)

服务端使用的是firebase,接口数据也都有, 前端代理也设置了, 由于访问的是https 在package.json的start处也设置了set HTTPS=true 但还是报错 ``` Error occurred while trying to proxy request / from localhost:3000 to https://asia-east2-socialape-d6344.cloudfunctions.net/api (ETIMEDOUT) (https://nodejs.org/api/errors.html#errors_common_system_errors) ``` ![这是接口信息](https://img-ask.csdn.net/upload/202004/18/1587175630_27678.png) ![按照create-react-app官网设置的代理](https://img-ask.csdn.net/upload/202004/18/1587175673_798700.png) ![图片说明](https://img-ask.csdn.net/upload/202004/18/1587175718_245032.png) 又遇到过这个问题的么,我看问题的描述是在进行代理的过程中发生的错误,不知道怎么解决了, 谢谢!!!

求教一个mongoose.connect(),是什么意思,有什么作用?

``` var express = require('express') var bodyParser = require('body-parser') var path = require('path') var mongoose = require('mongoose') var _ = require('underscore') var Movie = require('./models/movie') var port = process.env.PORT || 3000 var app = express() mongoose.connect('mongodb://localhost/imooc') ``` 请问这里的mongoose.connect('mongodb://localhost/imooc')是什么意思,有什么作用?

当我使用Hyperledger composer创建区块链应用程序,使用Angular app时,出现错误,为什么?

我使用**Hyperledger composer**创建了区块链应用程序,我先使用命令 ``` yo hyperledger-composer:angular ``` 在创建的文件下使用命令 ``` npm start ``` 以及使用了命令 ``` composer-rest-server ``` 这一切正常,我登录到了localhost:4200网站上, 网站可以正常登陆,但是功能模块无法使用,显示: ``` Error: 404 - Could not find API route. Please check your available APIs. ``` ``` Error occurred while trying to proxy request /api/Cow from localhost:4200 to http://localhost:3000 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors) ``` ``` Unhandled error for request GET /api/Cow: Error: There is no method to handle GET /Cow ``` 为什么?怎么解决?求教

尝试使用docker compose文件连接Redis时连接被拒绝

<div class="post-text" itemprop="text"> <p>我在尝试使用redis-golang驱动程序连接到Redis时遇到问题。 这是我的 <code>docker-compose.yml</code>文件 : </p> <pre><code>version: "3" services: driver: build: ./API-Golang command: go run app.go volumes: - ./API-Golang:/app ports: - "8080:8080" depends_on: - db - redis links : - redis - db redis: image: redis container_name: redis ports: ["6379:6379"] db: image: mongo:3.4.2 container_name: mongodb ports : ["27017:27017"] </code></pre> <p>这是我试图连接到redis (API-Golang/数据库/allSystem.go)的代码:</p> <pre><code>redisConn := RedisHost{ Address: "localhost:6379", Password: "", DB: 0, } redisConnection, err := redisConn.Connect() if err != nil { panic(err) } </code></pre> <p>我试图改变 <code>localhost</code>为 <code>redis</code> 但它还是不管用。错误如下:</p> <pre><code>driver_1 | panic: dial tcp [::1]:6379: getsockopt: connection refused driver_1 | driver_1 | goroutine 1 [running]: driver_1 | github.com/Gujarats/API-Golang/database.SystemConnection(0x48) driver_1 | /go/src/github.com/Gujarats/API-Golang/database/allSystem.go:32 +0x3d3 driver_1 | main.main() driver_1 | /go/src/github.com/Gujarats/API-Golang/app.go:24 +0x34 driver_1 | exit status 2 </code></pre> <p>你知道哪里出错了吗?</p> <p><a href="https://github.com/Gujarats/Go-docker" rel="nofollow noreferrer">源代码</a></p> </div>

跨域请求:Proxy error: Could not proxy request 时不时的报这个错误,不知道为啥?

最近在做毕设,前端用的react,后台是node+express+mongodb,接口都写 好了,postman测试也没问题,因为项目里有聊天的功能,所以加入了websocket 进行即时聊天,后台的接口是locahost:4000,socket也是,可就在调接口的时候 浏览器一直报Proxy error,前期一直以为跨域设置的问题,看了很多文档,试了 很多,感觉应该不是跨域的问题,后来又去查是不是端口被占用,发现4000端口 就是我用的浏览器和node在占用,没有别的程序占用,停止了再重启服务器和 客户端还是没用, 重点来了:1.每次开机时,启动项目后,数据调用一切正常 可只要我退出登录再重新登录的时候,就又有很多的500错误proxy error; 2.就是当我某个用户在浏览器上一直处于登录着的状态时,过一段时间后,它就又可以愉快的调数据了,无报错 我试过把后台的连接socket的端口改为了5000,还是不行,我感觉可能是重新登录后,项目是不是又重新连接了服务器啥的,导致端口被占用,所以总是报500 错误,想问下各位大佬,有没有遇到过这种问题,总结一下就是:接口时好时坏, 总是有proxy error的错误,难受我好几天了。。。个人感觉不是前端跨域的问题,求各位大佬出来帮小弟 指点迷津啊,在此感激不尽啊!!! ![图片说明](https://img-ask.csdn.net/upload/202002/12/1581490300_538416.png) ![图片说明](https://img-ask.csdn.net/upload/202002/12/1581490314_869475.png)

#2002 - 无法建立连接,因为目标计算机主动拒绝它。 Wamp服务器

<div class="post-text" itemprop="text"> <p>I'm trying to connect Android with PHP, MySQL, for that I'm referring <a href="http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/" rel="nofollow noreferrer">this tutorial</a>. I installed WAMP server successfully on my local machine and now I want login to phpmyadmin by entering "<a href="http://localhost/phpmyadmin" rel="nofollow noreferrer">http://localhost/phpmyadmin</a>" url in my browser but I'm getting following error-</p> <pre><code>#2002 - No connection could be made because the target machine actively refused it. — The server is not responding (or the local server's socket is not correctly configured). </code></pre> <p>For more information, please see the below screenshot-</p> <p><a href="https://i.stack.imgur.com/ytvwe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ytvwe.png" alt="enter image description here"></a></p> <p>One more thing I would like to mention here is, after starting Wamp server it shows the icon in Orange colour. I googled n tried almost all available solutions but unable to resolve my issue yet. The strange thing is yesterday it was working successfully but in today morning when I tried to login again I'm getting this error. Please help me to resolve this issue also let me know if I can provide more information for the same. Thank you.</p> </div>

postgresql客户端远程连接不了

![图片说明](https://img-ask.csdn.net/upload/201707/07/1499438334_769433.jpg) 防火墙开了5433端口了 下面是pg_hba.conf,不知道后面那个端口设为0有没有问题(不知道应该是什么) ![图片说明](https://img-ask.csdn.net/upload/201707/07/1499438404_837920.jpg) 下面是postgresql.conf ![图片说明](https://img-ask.csdn.net/upload/201707/07/1499438519_696392.jpg) ![图片说明](https://img-ask.csdn.net/upload/201707/07/1499438622_90366.jpg)

在启用安全性的情况下运行自定义区块链(hyperledger)应用程序时出错

<div class="post-text" itemprop="text"> <p>I'm running my blockchain application on local network setup using Vagrant.<br> The network (ca and vp ) are running inside Vagrant VM while my application resides outside Vagrant. When I ran my application with security disabled, everything works fine. But now when I tried with security enabled, I'm getting the following error: </p> <pre><code>himanshus-mbp:BCApplication himanshutyagi$ node app.js loading hardcoded peers loading hardcoded users [ibc-js] Peer: vp0-dev_vp0...:5000 [ibc-js] No membership users found after filtering, assuming this is a network w/o membership [ibc-js] Found chaincode in local file system [ibc-js] Scanning files [ '.DS_Store', 'chaincode_finished.go', 'finished' ] [ibc-js] Parsing file for shim version [ibc-js] Found shim version: github.com/hyperledger/fabric/core/chaincode/shim [ibc-js] Parsing file for invoke functions - chaincode_finished.go [ibc-js] Found cc invoke function: init [ibc-js] Found cc invoke function: delete_product [ibc-js] Found cc invoke function: delete_offering [ibc-js] Found cc invoke function: delete_contract [ibc-js] Found cc invoke function: delete_client [ibc-js] Found cc invoke function: write [ibc-js] Found cc invoke function: init_product [ibc-js] Found cc invoke function: init_offering [ibc-js] Found cc invoke function: init_contract [ibc-js] Found cc invoke function: init_client [ibc-js] Found cc invoke function: set_user_type [ibc-js] Parsing file for query functions - chaincode_finished.go [ibc-js] Found cc query function: read [ibc-js] Found cc query function: read_product_index [ibc-js] Found cc query function: read_offering_index [ibc-js] Found cc query function: read_contract_index [ibc-js] Found cc query function: read_client_index [ibc-js] load_chaincode() finished chaincode summary file indicates chaincode has been previously deployed ------------------------------------------ Chain is up and running ------------------------------------------ Getting Offering List: [ibc-js] read - success: { jsonrpc: '2.0', error: { code: -32602, message: 'Invalid params', data: 'Must supply username for chaincode when security is enabled.' }, id: 1469460324754 } read _offeringindex: null { name: 'query() resp error', code: 400, details: { code: -32602, message: 'Invalid params', data: 'Must supply username for chaincode when security is enabled.' } } /Users/himanshutyagi/Desktop/workspace/node_modules/async/lib/async.js:106 if (!arr.length) { ^ TypeError: Cannot read property 'length' of null at Object.async.each (/Users/himanshutyagi/Desktop/workspace/node_modules/async/lib/async.js:106:17) at /Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/app.js:379:10 at Object.options.success (/Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/node_modules/ibm-blockchain-js/index.js:1020:22) at success (/Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/node_modules/ibm-blockchain-js/lib/rest.js:109:30) at IncomingMessage.&lt;anonymous&gt; (/Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/node_modules/ibm-blockchain-js/lib/rest.js:192:7) at emitNone (events.js:72:20) at IncomingMessage.emit (events.js:166:7) at endReadableNT (_stream_readable.js:921:12) at nextTickCallbackWith2Args (node.js:442:9) at process._tickCallback (node.js:356:17) </code></pre> <p>What also is weird is that in the logs, it says <code>No membership users found after filtering</code> I also re deployed the chaincode with the same <code>enrollID and enrollPW</code> as I've mentioned in my <code>app.js</code> blockchain js configuration. Following are the details:</p> <pre><code>var options = { network:{ /* peers: peers, users: users, options: {quiet: true, tls:false, maxRetry: 1}*/ 'peers': [ { 'discovery_host': 'localhost', 'discovery_port': 30303, 'api_host': 'localhost', 'api_port_tls': 443, 'api_port': 5000, 'type': 'peer', 'network_id': 'dev', 'id': 'dev_vp0', 'api_url': 'http://localhost:5000' } ], "users": [ { "username": "tyagi_user_type1", "secret": "1ccf8703ac", "enrollId": "tyagi_type1", "enrollSecret": "1ccf8703ac" } ], options: {quiet: true, tls:false, maxRetry: 1} }, ... }; </code></pre> <p>What does "Must supply username for chaincode" mean. Has anyone faced a similar issue while running with security enabled on a local network ? <br> <strong>UPDATE:</strong> So, I changed the enrillId to <code>user_type1_xxx</code> , now "No Membership users found.." message doesn't come anymore. But I'm getting a connection refused error when the user is trying to register. </p> <pre><code>himanshus-mbp:BCApplication himanshutyagi$ node app.js loading hardcoded peers loading hardcoded users [ibc-js] Peer: vp0-dev_vp0...:443 [ibc-js] Registering vp0-dev_vp0...:443 w/enrollID - user_type1_tyagi [ibc-js] Register - failure x1 : user_type1_tyagi 500 [ibc-js] going to try to register again in 30 secs Query for the product table executed Query for the offering table executed Query for the contract table executed Query for the product table executed [ibc-js] Registering vp0-dev_vp0...:443 w/enrollID - user_type1_tyagi [ibc-js] Register - failure x2 : user_type1_tyagi 500 [ibc-js] going to try to register again in 30 secs Query for the product table executed Query for the offering table executed Query for the contract table executed Query for the product table executed [ibc-js] Registering vp0-dev_vp0...:443 w/enrollID - user_type1_tyagi [ibc-js] Register - failure x3 : user_type1_tyagi 500 [ibc-js] going to try to register again in 30 secs Query for the product table executed Query for the offering table executed Query for the contract table executed Query for the product table executed Query for the product table executed Query for the offering table executed Query for the contract table executed Query for the product table executed [ibc-js] Registering vp0-dev_vp0...:443 w/enrollID - user_type1_tyagi [ibc-js] Register - failure x4 : user_type1_tyagi 500 ! looks like an error loading the chaincode or network, app will fail { name: 'register() error', code: 500, details: { [Error: connect ECONNREFUSED 127.0.0.1:443] code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 443 } } </code></pre> </div>

AsyncTask Android PHP得到“<<应用程序>>停止工作”

<div class="post-text" itemprop="text"> <p>I am using AsynTask to send data to php and receive a name to print but it showed the following error. How can I fix this?</p> <p><strong>LOGCAT</strong></p> <pre><code>12-29 21:38:27.588: W/dalvikvm(1283): threadid=11: thread exiting with uncaught exception (group=0x40a71930) 12-29 21:38:27.748: E/AndroidRuntime(1283): FATAL EXCEPTION: AsyncTask #1 12-29 21:38:27.748: E/AndroidRuntime(1283): java.lang.RuntimeException: An error occured while executing doInBackground() 12-29 21:38:27.748: E/AndroidRuntime(1283): at android.os.AsyncTask$3.done(AsyncTask.java:299) 12-29 21:38:27.748: E/AndroidRuntime(1283): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 12-29 21:38:27.748: E/AndroidRuntime(1283): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 12-29 21:38:27.748: E/AndroidRuntime(1283): at java.util.concurrent.FutureTask.run(FutureTask.java:239) 12-29 21:38:27.748: E/AndroidRuntime(1283): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 12-29 21:38:27.748: E/AndroidRuntime(1283): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 12-29 21:38:27.748: E/AndroidRuntime(1283): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 12-29 21:38:27.748: E/AndroidRuntime(1283): at java.lang.Thread.run(Thread.java:856) 12-29 21:38:27.748: E/AndroidRuntime(1283): Caused by: java.lang.NullPointerException 12-29 21:38:27.748: E/AndroidRuntime(1283): at com.example.myweb.toPHP.getUserLoggedIn(toPHP.java:99) 12-29 21:38:27.748: E/AndroidRuntime(1283): at com.example.myweb.toPHP.doInBackground(toPHP.java:67) 12-29 21:38:27.748: E/AndroidRuntime(1283): at com.example.myweb.toPHP.doInBackground(toPHP.java:1) 12-29 21:38:27.748: E/AndroidRuntime(1283): at android.os.AsyncTask$2.call(AsyncTask.java:287) 12-29 21:38:27.748: E/AndroidRuntime(1283): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 12-29 21:38:27.748: E/AndroidRuntime(1283): ... 4 more </code></pre> <p>This is my Java code to send data to PHP:</p> <p><strong>toPHP.java</strong></p> <pre><code>package com.example.myweb; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.json.JSONException; import org.json.JSONObject; import android.os.AsyncTask; import android.os.Bundle; import android.app.Activity; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.TextView; public class toPHP extends AsyncTask{ final MainActivity main; public toPHP(MainActivity main) { this.main = main; } private JSONParser jsonParser; String email,password; EditText emailBox; EditText passwordBox; @Override protected void onPreExecute() { super.onPreExecute(); TextView textV1 = (TextView)main.findViewById(R.id.textV1); textV1.setText("Reaching em!!"); } @Override protected JSONObject doInBackground(Object... v) { //main = (MainActivity)parameters[0]; main.afterEffect("sending..."); emailBox = (EditText) main.findViewById(R.id.email); passwordBox = (EditText) main.findViewById(R.id.password); email = emailBox.getText().toString(); password = passwordBox.getText().toString(); JSONObject json = null; main.afterEffect("sending2..."); try { json = getUserLoggedIn(email, password); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); //9b6a45925f32c3ce5a8b3413605b16d6 } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return json; } public JSONObject getUserLoggedIn(String email,String password) throws ClientProtocolException, IOException, JSONException{ JSONObject json = null; /* HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("http://localhost/testand.php"); */ List&lt;NameValuePair&gt; pairs = new ArrayList&lt;NameValuePair&gt;(); pairs.add(new BasicNameValuePair("email", email)); pairs.add(new BasicNameValuePair("password", password)); //post.setEntity(new UrlEncodedFormEntity(pairs)); //HttpResponse response = client.execute(post); //HttpEntity resEntity = response.getEntity(); //if (resEntity != null) { //String responseStr = EntityUtils.toString(resEntity).trim(); json = jsonParser.getJSONFromUrl("http://localhost/testand.php", pairs); //} return json; } protected void onPostExecute(JSONObject json) { String myName=""; try { myName = json.getString("name"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } String str = myName + ", Welcome to Socionet. :) "; main.afterEffect(str); } } </code></pre> <p>The following is my main Java code:</p> <p><strong>MainActivity.java</strong></p> <pre><code>package com.example.myweb; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.json.JSONException; import org.json.JSONObject; import android.os.AsyncTask; import android.os.Bundle; import android.app.Activity; import android.util.Log; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.TextView; public class MainActivity extends Activity { Button button; EditText emailBox; EditText passwordBox; String emailId; String passwordId; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.login1); emailBox = (EditText)findViewById(R.id.email); passwordBox = (EditText)findViewById(R.id.password); button.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { try { new toPHP(MainActivity.this).execute(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } public void afterEffect(String str){ TextView textV1 = (TextView)findViewById(R.id.textV1); textV1.setText(str); } } </code></pre> <p>The following is my JSON Parser code:</p> <p><strong>JSONParser.java</strong></p> <pre><code>package com.example.myweb; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONException; import org.json.JSONObject; import android.util.Log; public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; // constructor public JSONParser() { } public JSONObject getJSONFromUrl(String url, List params) { // Making HTTP request try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "n"); } is.close(); json = sb.toString(); Log.e("JSON", json); } catch (Exception e) { Log.e("Buffer Error", "Error converting result " + e.toString()); } // try parse the string to a JSON object try { jObj = new JSONObject(json); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } // return JSON String return jObj; } } </code></pre> <p><strong>EDIT:</strong> This is my LOGCAT2 response after savchak's fix:</p> <p><strong>LOGCAT2</strong> </p> <pre><code>12-30 06:44:19.664: W/System.err(777): org.apache.http.conn.HttpHostConnectException: Connection to http://localhost refused 12-30 06:44:19.744: W/System.err(777): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183) 12-30 06:44:19.744: W/System.err(777): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) 12-30 06:44:19.744: W/System.err(777): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) 12-30 06:44:19.744: W/System.err(777): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360) 12-30 06:44:19.754: W/System.err(777): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) 12-30 06:44:19.764: W/System.err(777): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487) 12-30 06:44:19.764: W/System.err(777): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465) 12-30 06:44:19.764: W/System.err(777): at com.example.myweb.JSONParser.getJSONFromUrl(JSONParser.java:33) 12-30 06:44:19.774: W/System.err(777): at com.example.myweb.toPHP.getUserLoggedIn(toPHP.java:99) 12-30 06:44:19.784: W/System.err(777): at com.example.myweb.toPHP.doInBackground(toPHP.java:67) 12-30 06:44:19.784: W/System.err(777): at com.example.myweb.toPHP.doInBackground(toPHP.java:1) 12-30 06:44:19.804: W/System.err(777): at android.os.AsyncTask$2.call(AsyncTask.java:287) 12-30 06:44:19.804: W/System.err(777): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 12-30 06:44:19.804: W/System.err(777): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 12-30 06:44:19.814: W/System.err(777): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 12-30 06:44:19.824: W/System.err(777): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 12-30 06:44:19.824: W/System.err(777): at java.lang.Thread.run(Thread.java:856) 12-30 06:44:19.824: W/System.err(777): Caused by: java.net.ConnectException: failed to connect to /127.0.0.1 (port 80): connect failed: ECONNREFUSED (Connection refused) 12-30 06:44:19.844: W/System.err(777): at libcore.io.IoBridge.connect(IoBridge.java:114) 12-30 06:44:19.864: W/System.err(777): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192) 12-30 06:44:19.864: W/System.err(777): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459) 12-30 06:44:19.864: W/System.err(777): at java.net.Socket.connect(Socket.java:842) 12-30 06:44:19.864: W/System.err(777): at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119) 12-30 06:44:19.874: W/System.err(777): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144) 12-30 06:44:19.884: W/System.err(777): ... 16 more 12-30 06:44:19.934: W/System.err(777): Caused by: libcore.io.ErrnoException: connect failed: ECONNREFUSED (Connection refused) 12-30 06:44:20.004: W/System.err(777): at libcore.io.Posix.connect(Native Method) 12-30 06:44:20.004: W/System.err(777): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85) 12-30 06:44:20.004: W/System.err(777): at libcore.io.IoBridge.connectErrno(IoBridge.java:127) 12-30 06:44:20.025: W/System.err(777): at libcore.io.IoBridge.connect(IoBridge.java:112) 12-30 06:44:20.025: W/System.err(777): ... 21 more 12-30 06:44:20.025: E/Buffer Error(777): Error converting result java.lang.NullPointerException: lock == null 12-30 06:44:20.034: E/JSON Parser(777): Error parsing data org.json.JSONException: End of input at character 0 of </code></pre> </div>

无法使用终端或PHP linux通过sendmail发送邮件

<div class="post-text" itemprop="text"> <p>I have installed sendmail on my linux machine(Linux Mint) and I followed : <a href="https://stackoverflow.com/questions/10359437/sendmail-how-to-configure-sendmail-on-ubuntu">how to configure sendmail on ubuntu</a> on Stack Overflow.</p> <p>I got no errors till the end and I successfully restarted the sendmail.</p> <p>To check I tried using telnet. Here's the terminal print</p> <pre><code>hackathon mail # telnet 127.0.0.1 25 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. 220 hackathon ESMTP Sendmail 8.14.4/8.14.4/Debian-4.1ubuntu1; Sat, 7 Mar 2015 14:59:26 +0530; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1] HELO server 250 hackathon Hello localhost [127.0.0.1], pleased to meet you MAIL from : localhostmailbox@gmail.com 250 2.1.0 localhostmailbox@gmail.com... Sender ok RCPT to : naveenchaudhary2010@hotmail.com 250 2.1.5 naveenchaudhary2010@hotmail.com... Recipient ok DATA 354 Enter mail, end with "." on a line by itself Subject : Test mail . 250 2.0.0 t279TQBC024546 Message accepted for delivery quit 221 2.0.0 hackathon closing connection Connection closed by foreign host. </code></pre> <p>Though telnet says message accepted to deliver, but I see no mail neither in Inbox or Junk of recepient, nor in the sent folder of sender.</p> <p>I tried using php also. php.ini settings :</p> <pre><code>; For Win32 only. ; http://php.net/smtp SMTP=smtp.gmail.com ; http://php.net/smtp-port smtp_port=587 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = localhostmailbox@gmail.com ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path ;sendmail_path = </code></pre> <p>Here's the PHP code :</p> <pre><code>&lt;?php $to = "naveenchaudhary2010@hotmail.com"; $subject = "test"; $body = "This is a text"; $headers = 'From : "localhost" localhostmailbox@gmail.com'; $return_val = mail($to,$subject,$body,$headers); if($return_val) echo "sent"; else echo "Failure :".$return_val; ?&gt; </code></pre> <p>This is also sending the error.I tried printing the return value of <code>mail()</code> which is <code>null</code>. Please help, this is my 7th hour wasted since morning and still no success till now.</p> <p><strong>EDIT</strong></p> <p>Dump of strace</p> <pre><code>2558 &lt;... time resumed&gt; NULL) = 1425817211 13250 &lt;... read resumed&gt; "127.0.0.1\tlocalhost 127.0.1.1\thackathon # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes"..., 4096) = 224 2558 rt_sigprocmask(SIG_UNBLOCK, [ALRM], &lt;unfinished ...&gt; 13250 close(4 &lt;unfinished ...&gt; 2558 &lt;... rt_sigprocmask resumed&gt; [ALRM], 8) = 0 13250 &lt;... close resumed&gt; ) = 0 2558 select(7, [4 5 6], NULL, NULL, {5, 0} &lt;unfinished ...&gt; 13250 munmap(0xb77a6000, 4096) = 0 13250 fcntl64(8, F_GETFL) = 0x2 (flags O_RDWR) 13250 dup(8) = 4 13250 fcntl64(4, F_GETFL) = 0x2 (flags O_RDWR) 13250 getsockname(8, {sa_family=AF_INET, sin_port=htons(25), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 13250 open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 5 13250 fstat64(5, {st_mode=S_IFREG|0644, st_size=224, ...}) = 0 13250 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77a6000 13250 read(5, "127.0.0.1\tlocalhost 127.0.1.1\thackathon # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes"..., 4096) = 224 13250 close(5) = 0 13250 munmap(0xb77a6000, 4096) = 0 13250 getegid32() = 126 13250 setgroups32(1, [126]) = 0 13250 ioctl(8, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbf855618) = -1 ENOTTY (Inappropriate ioctl for device) 13250 getpeername(8, {sa_family=AF_INET, sin_port=htons(51828), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 13250 stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=187, ...}) = 0 13250 open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 5 13250 fstat64(5, {st_mode=S_IFREG|0644, st_size=187, ...}) = 0 13250 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77a6000 13250 read(5, "# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.1.1 search 8.8.8.8 ", 4096) = 187 13250 read(5, "", 4096) = 0 13250 close(5) = 0 13250 munmap(0xb77a6000, 4096) = 0 13250 stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=187, ...}) = 0 13250 open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 5 13250 fstat64(5, {st_mode=S_IFREG|0644, st_size=224, ...}) = 0 13250 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77a6000 13250 read(5, "127.0.0.1\tlocalhost 127.0.1.1\thackathon # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes"..., 4096) = 224 13250 read(5, "", 4096) = 0 13250 close(5) = 0 13250 munmap(0xb77a6000, 4096) = 0 13250 getsockname(8, {sa_family=AF_INET, sin_port=htons(25), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 13250 open("/etc/services", O_RDONLY|O_CLOEXEC) = 5 13250 fstat64(5, {st_mode=S_IFREG|0644, st_size=19558, ...}) = 0 13250 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77a6000 13250 read(5, "# Network services, Internet style # # Note that it is presently the policy of IANA to assign a single well-known # port number for both TCP and UDP; hence, officially ports have two entries # even if"..., 4096) = 4096 13250 close(5) = 0 13250 munmap(0xb77a6000, 4096) = 0 13250 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 13250 rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0 13250 time(NULL) = 1425817211 13250 rt_sigaction(SIGALRM, {0x80e56d0, [], SA_RESTART}, {0x80e56d0, [], SA_RESTART}, 8) = 0 13250 alarm(5) = 0 13250 rt_sigprocmask(SIG_UNBLOCK, [ALRM], [ALRM], 8) = 0 13250 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 5 13250 bind(5, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 13250 connect(5, {sa_family=AF_INET, sin_port=htons(113), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 ECONNREFUSED (Connection refused) 13250 close(5) = 0 13250 rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0 13250 rt_sigprocmask(SIG_UNBLOCK, [ALRM], [ALRM], 8) = 0 13250 kill(13250, SIGALRM) = 0 13250 --- SIGALRM {si_signo=SIGALRM, si_code=SI_USER, si_pid=13250, si_uid=0} --- 13250 alarm(0) = 5 13250 time(NULL) = 1425817211 13250 time(NULL) = 1425817211 13250 sigreturn() (mask []) = 0 13250 getsockopt(8, SOL_IP, IP_OPTIONS, "", [0]) = 0 13250 time(NULL) = 1425817211 13250 time(NULL) = 1425817211 13250 open("/proc/loadavg", O_RDONLY) = 5 13250 fstat64(5, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 13250 read(5, "0.56 0.24 0.22 1/414 13250 ", 1024) = 27 13250 close(5) = 0 13250 time(NULL) = 1425817211 13250 stat64("/etc/mail/access.db", {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 lstat64("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13250 geteuid32() = 0 13250 lstat64("/etc", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 13250 geteuid32() = 0 13250 lstat64("/etc/mail", {st_mode=S_IFDIR|S_ISGID|0755, st_size=4096, ...}) = 0 13250 geteuid32() = 0 13250 open("/etc/mail/access.db", O_RDONLY) = 5 13250 fstat64(5, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(5, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 time(NULL) = 1425817211 13250 open("/sys/devices/system/cpu/online", O_RDONLY|O_CLOEXEC) = 6 13250 read(6, "0-1 ", 8192) = 4 13250 close(6) = 0 13250 stat64("/etc/mail/access.db", {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 open("/etc/mail/access.db", O_RDONLY|O_LARGEFILE) = 6 13250 fcntl64(6, F_GETFD) = 0 13250 fcntl64(6, F_SETFD, FD_CLOEXEC) = 0 13250 read(6, "\0\0\0\0\1\0\0\0\0\0\0\0a\25\6\0\t\0\0\0\0\20\0\0\0\10\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0_\v\20\0\6\10\0\0\321\326B\375\245^\0\0\0\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\27\20\0\0\321\215h^\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512 13250 open("DB_CONFIG", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) 13250 stat64("/var/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0 13250 time(NULL) = 1425817211 13250 clock_gettime(CLOCK_REALTIME, {1425817211, 773188844}) = 0 13250 clock_gettime(CLOCK_REALTIME, {1425817211, 773264483}) = 0 13250 open("/etc/mail/access.db", O_RDONLY|O_LARGEFILE) = 7 13250 fcntl64(7, F_GETFD) = 0 13250 fcntl64(7, F_SETFD, FD_CLOEXEC) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 pread64(7, "\0\0\0\0\1\0\0\0\0\0\0\0a\25\6\0\t\0\0\0\0\20\0\0\0\10\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0_\v\20\0\6\10\0\0\321\326B\375\245^\0\0\0\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\27\20\0\0\321\215h^\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096, 0) = 4096 13250 close(5) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 pread64(7, "\0\0\0\0\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\22\0C\17\0 \353\17\351\17\324\17\322\17\306\17\300\17\260\17\251\17\235\17\226\17\212\17\203\17r\17l\17W\17U\17J\17C\17\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096, 4096) = 4096 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 pread64(7, "\0\0\0\0\1\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\34\0\363\16\0 \361\17\357\17\333\17\331\17\315\17\312\17\273\17\271\17\245\17\243\17\227\17\224\17\204\17}\17k\17e\17V\17T\17@\17&gt;\0172\17-\17%\17\36\17\22\17\v\17\372\16\363\16\0\0\0\0\0\0\0\20\0\0\321\215h^\1\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096, 8192) = 4096 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 open("/etc/hosts.allow", O_RDONLY) = 5 13250 fstat64(5, {st_mode=S_IFREG|0644, st_size=425, ...}) = 0 13250 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb77a6000 13250 read(5, "sendmail: all # /etc/hosts.allow: list of hosts that are allowed to access the system. # See the manual pages hosts_access(5) and hosts_options(5). # # Example: ALL: LOCAL @some_n"..., 4096) = 425 13250 close(5) = 0 13250 munmap(0xb77a6000, 4096) = 0 13250 dup2(4, 1) = 1 13250 time(NULL) = 1425817211 13250 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=265, ...}) = 0 13250 time(NULL) = 1425817211 13250 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=265, ...}) = 0 13250 open("/proc/loadavg", O_RDONLY) = 5 13250 fstat64(5, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 13250 read(5, "0.56 0.24 0.22 1/414 13250 ", 1024) = 27 13250 close(5) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 getpeername(8, {sa_family=AF_INET, sin_port=htons(51828), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 13250 getsockname(8, {sa_family=AF_INET, sin_port=htons(25), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 13250 fcntl64(7, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(7, {st_mode=S_IFREG|0640, st_size=12288, ...}) = 0 13250 fcntl64(7, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0 13250 fstat64(4, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0 13250 fcntl64(8, F_GETFL) = 0x2 (flags O_RDWR) 13250 fcntl64(8, F_SETFL, O_RDWR|O_NONBLOCK) = 0 13250 fstat64(8, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0 13250 select(9, [8], NULL, NULL, {0, 0}) = 0 (Timeout) 13250 write(4, "220 hackathon ESMTP Sendmail 8.14.4/8.14.4/Debian-4.1ubuntu1; Sun, 8 Mar 2015 17:50:11 +0530; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1] ", 165) = 165 13250 read(8, 0x8bd35d8, 4096) = -1 EAGAIN (Resource temporarily unavailable) 13250 gettimeofday({1425817211, 849076}, NULL) = 0 13250 select(9, [8], NULL, [8], {300, 0} &lt;unfinished ...&gt; 2558 &lt;... select resumed&gt; ) = 0 (Timeout) 2558 rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0 2558 time(NULL) = 1425817216 2558 time(NULL) = 1425817216 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.60 0.26 0.23 1/414 13250 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817216 2558 time(NULL) = 1425817216 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.60 0.26 0.23 1/414 13250 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817216 2558 rt_sigprocmask(SIG_UNBLOCK, [ALRM], [ALRM], 8) = 0 2558 select(7, [4 5 6], NULL, NULL, {5, 0} &lt;unfinished ...&gt; 13250 &lt;... select resumed&gt; ) = 1 (in [8], left {292, 398402}) 13250 gettimeofday({1425817219, 450896}, NULL) = 0 13250 read(8, "HELO server ", 4096) = 13 13250 fcntl64(4, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK) 13250 fcntl64(4, F_SETFL, O_RDWR) = 0 13250 fcntl64(8, F_GETFL) = 0x2 (flags O_RDWR) 13250 fcntl64(8, F_SETFL, O_RDWR|O_NONBLOCK) = 0 13250 select(9, [8], NULL, NULL, {0, 0}) = 0 (Timeout) 13250 write(4, "250 hackathon Hello localhost [127.0.0.1], pleased to meet you ", 64) = 64 13250 read(8, 0x8bd35d8, 4096) = -1 EAGAIN (Resource temporarily unavailable) 13250 gettimeofday({1425817219, 451708}, NULL) = 0 13250 select(9, [8], NULL, [8], {300, 0} &lt;unfinished ...&gt; 2558 &lt;... select resumed&gt; ) = 0 (Timeout) 2558 rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0 2558 time(NULL) = 1425817221 2558 time(NULL) = 1425817221 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.55 0.25 0.23 1/414 13250 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817221 2558 time(NULL) = 1425817221 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.55 0.25 0.23 1/414 13250 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817221 2558 rt_sigprocmask(SIG_UNBLOCK, [ALRM], [ALRM], 8) = 0 2558 select(7, [4 5 6], NULL, NULL, {5, 0}) = 0 (Timeout) 2558 rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0 2558 time(NULL) = 1425817226 2558 time(NULL) = 1425817226 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.51 0.25 0.22 4/413 13250 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817226 2558 time(NULL) = 1425817226 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.51 0.25 0.22 4/413 13250 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817226 2558 rt_sigprocmask(SIG_UNBLOCK, [ALRM], [ALRM], 8) = 0 2558 select(7, [4 5 6], NULL, NULL, {5, 0}) = 0 (Timeout) 2558 rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0 2558 time(NULL) = 1425817231 2558 time(NULL) = 1425817231 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.55 0.26 0.23 1/412 13251 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817231 2558 time(NULL) = 1425817231 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.55 0.26 0.23 1/412 13251 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817231 2558 rt_sigprocmask(SIG_UNBLOCK, [ALRM], [ALRM], 8) = 0 2558 select(7, [4 5 6], NULL, NULL, {5, 0}) = 0 (Timeout) 2558 rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0 2558 time(NULL) = 1425817236 2558 time(NULL) = 1425817236 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.50 0.26 0.23 1/412 13251 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817236 2558 time(NULL) = 1425817236 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.50 0.26 0.23 1/412 13251 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817236 2558 rt_sigprocmask(SIG_UNBLOCK, [ALRM], [ALRM], 8) = 0 2558 select(7, [4 5 6], NULL, NULL, {5, 0}) = 0 (Timeout) 2558 rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0 2558 time(NULL) = 1425817241 2558 time(NULL) = 1425817241 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.46 0.25 0.23 1/411 13251 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817241 2558 time(NULL) = 1425817241 2558 open("/proc/loadavg", O_RDONLY) = 8 2558 fstat64(8, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 2558 read(8, "0.46 0.25 0.23 1/411 13251 ", 1024) = 27 2558 close(8) = 0 2558 time(NULL) = 1425817241 2558 rt_sigprocmask(SIG_UNBLOCK, [ALRM], [ALRM], 8) = 0 2558 select(7, [4 5 6], NULL, NULL, {5, 0} &lt;unfinished ...&gt; 13250 &lt;... select resumed&gt; ) = 1 (in [8], left {275, 280004}) 13250 gettimeofday({1425817244, 171941}, NULL) = 0 13250 read(8, "MAIL from :localhostmailbox@gmail.com ", 4096) = 39 13250 time(NULL) = 1425817244 13250 time(NULL) = 1425817244 13250 stat64("/etc/mail/service.switch", {st_mode=S_IFREG|0644, st_size=149, ...}) = 0 13250 lstat64("/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13250 geteuid32() = 0 13250 lstat64("/etc", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0 13250 geteuid32() = 0 13250 lstat64("/etc/mail", {st_mode=S_IFDIR|S_ISGID|0755, st_size=4096, ...}) = 0 13250 geteuid32() = 0 13250 open("/etc/mail/service.switch", O_RDONLY) = 5 13250 fstat64(5, {st_mode=S_IFREG|0644, st_size=149, ...}) = 0 13250 fcntl64(5, F_GETFL) = 0 (flags O_RDONLY) 13250 fstat64(5, {st_mode=S_IFREG|0644, st_size=149, ...}) = 0 13250 read(5, "# /etc/mail/nsswitch.conf # # This is the format that sendmail expects (no colon after the service) # passwd\t\tfiles hosts\t\tfiles dns aliases\t\tfiles ", 4096) = 149 13250 read(5, "", 4096) = 0 13250 close(5) = 0 13250 open("/etc/hosts", O_RDONLY) = 5 13250 fstat64(5, {st_mode=S_IFREG|0644, st_size=224, ...}) = 0 13250 read(5, "127.0.0.1\tlocalhost 127.0.1.1\thackathon # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes"..., 4096) = 224 13250 read(5, "", 4096) = 0 13250 close(5) = 0 13250 stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=187, ...}) = 0 13250 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 5 13250 connect(5, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.1.1")}, 16) = 0 13250 gettimeofday({1425817244, 174299}, NULL) = 0 13250 poll([{fd=5, events=POLLOUT}], 1, 0) = 1 ([{fd=5, revents=POLLOUT}]) 13250 send(5, "*\311\1\0\0\1\0\0\0\0\0\0\5gmail\3com\0\0\34\0\1", 27, MSG_NOSIGNAL) = 27 13250 poll([{fd=5, events=POLLIN}], 1, 5000) = 1 ([{fd=5, revents=POLLIN}]) 13250 recvfrom(5, "*\311\201\200\0\1\0\1\0\4\0\4\5gmail\3com\0\0\34\0\1\300\f\0\34\0\1\0\0\0002\0\20$\4h\0@\2\10\2\0\0\0\0\0\0\20\25\300\f\0\2\0\1\0\0\17\0\0 \3ns4\6google\300\22\300\f\0\2\0\1\0\0\17\0\0\6\3ns3\300G\300\f\0\2\0\1\0\0\17\0\0\6\3ns2\300G\300\f\0\2\0\1\0\0\17\0\0\6\3ns1\300G\300\200\0\1\0\1\0\0\2B\0\4\330\357 \300n\0\1\0\1\0\0\2B\0\4\330\357\" \300\\\0\1\0\1\0\0\2B\0\4\330\357$ \300C\0\1\0\1\0\0\2B\0\4\330\357&amp; ", 8192, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.1.1")}, [16]) = 198 13250 close(5) = 0 13250 time(NULL) = 1425817244 13250 time(NULL) = 1425817244 13250 fcntl64(4, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK) 13250 fcntl64(4, F_SETFL, O_RDWR) = 0 13250 fcntl64(8, F_GETFL) = 0x2 (flags O_RDWR) 13250 fcntl64(8, F_SETFL, O_RDWR|O_NONBLOCK) = 0 13250 select(9, [8], NULL, NULL, {0, 0}) = 0 (Timeout) 13250 write(4, "250 2.1.0 localhostmailbox@gmail.com... Sender ok ", 51) = 51 13250 read(8, 0x8bd35d8, 4096) = -1 EAGAIN (Resource temporarily unavailable) </code></pre> </div>

2019 Python开发者日-培训

2019 Python开发者日-培训

150讲轻松搞定Python网络爬虫

150讲轻松搞定Python网络爬虫

设计模式(JAVA语言实现)--20种设计模式附带源码

设计模式(JAVA语言实现)--20种设计模式附带源码

YOLOv3目标检测实战:训练自己的数据集

YOLOv3目标检测实战:训练自己的数据集

java后台+微信小程序 实现完整的点餐系统

java后台+微信小程序 实现完整的点餐系统

三个项目玩转深度学习(附1G源码)

三个项目玩转深度学习(附1G源码)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

初级玩转Linux+Ubuntu(嵌入式开发基础课程)

2019 AI开发者大会

2019 AI开发者大会

玩转Linux:常用命令实例指南

玩转Linux:常用命令实例指南

一学即懂的计算机视觉(第一季)

一学即懂的计算机视觉(第一季)

4小时玩转微信小程序——基础入门与微信支付实战

4小时玩转微信小程序——基础入门与微信支付实战

Git 实用技巧

Git 实用技巧

Python数据清洗实战入门

Python数据清洗实战入门

使用TensorFlow+keras快速构建图像分类模型

使用TensorFlow+keras快速构建图像分类模型

实用主义学Python(小白也容易上手的Python实用案例)

实用主义学Python(小白也容易上手的Python实用案例)

程序员的算法通关课:知己知彼(第一季)

程序员的算法通关课:知己知彼(第一季)

MySQL数据库从入门到实战应用

MySQL数据库从入门到实战应用

机器学习初学者必会的案例精讲

机器学习初学者必会的案例精讲

手把手实现Java图书管理系统(附源码)

手把手实现Java图书管理系统(附源码)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

极简JAVA学习营第四期(报名以后加助教微信:eduxy-1)

.net core快速开发框架

.net core快速开发框架

玩转Python-Python3基础入门

玩转Python-Python3基础入门

Python数据挖掘简易入门

Python数据挖掘简易入门

微信公众平台开发入门

微信公众平台开发入门

程序员的兼职技能课

程序员的兼职技能课

Windows版YOLOv4目标检测实战:训练自己的数据集

Windows版YOLOv4目标检测实战:训练自己的数据集

HoloLens2开发入门教程

HoloLens2开发入门教程

微信小程序开发实战

微信小程序开发实战

Java8零基础入门视频教程

Java8零基础入门视频教程

Python可以这样学(第一季:Python内功修炼)

Python可以这样学(第一季:Python内功修炼)

C++语言基础视频教程

C++语言基础视频教程

Python可以这样学(第四季:数据分析与科学计算可视化)

Python可以这样学(第四季:数据分析与科学计算可视化)

网络工程师小白入门--【思科CCNA、华为HCNA等网络工程师认证】

网络工程师小白入门--【思科CCNA、华为HCNA等网络工程师认证】

Python数据分析与挖掘

Python数据分析与挖掘

微信小程序开发实战之番茄时钟开发

微信小程序开发实战之番茄时钟开发

软件测试2小时入门

软件测试2小时入门

相关热词 c# 开发接口 c# 中方法上面的限制 c# java 时间戳 c#单元测试入门 c# 数组转化成文本 c#实体类主外键关系设置 c# 子函数 局部 c#窗口位置设置 c# list 查询 c# 事件 执行顺序
立即提问