pztai.com
域名年龄: 13年11个月23天HTTP/1.1 301 永久重定向 服务器:nginx 访问时间:2015年03月23日 15:37:58 类型:text/html; charset=UTF-8 Transfer-Encoding: chunked 连接:keep-alive 动作:Cookie X-Pingback: http://www.pztai.com/xmlrpc.php 目标网址:http://www.pztai.com/ HTTP/1.1 200 OK 服务器:nginx 访问时间:2015年03月23日 15:37:58 类型:text/html; charset=UTF-8 Transfer-Encoding: chunked 连接:keep-alive 动作:Accept-Encoding 动作:Accept-Encoding, Cookie 缓存控制:max-age=3,必须更新 WP-Super-Cache: Served supercache file from PHP Content-Encoding: gzip 网站编码:UTF-8
首页PHP技术数据库技术Linux留言板菜单邰小胖子 Blog技术博客对于TCP的一些理解作者: taililong日期: 2015年3月18日没有评论最近在做网络流量优化,对于TCP的一些知识开始恶补1.连接 断开,这些课本上一直反复强调,三次握手,四次挥手就没什么好说了2.心跳机制,这部分以前都没怎么注意过,做移动端的时候开始注意这个问题,一般正常的关闭程序是会自动触发TCP的关闭的,但是一些意外情况就没法检测到了,还好,TCP自己有个keepalive机制,centos系统参数在/etc/sysctl.conf里面,相关参数三个tcp_keepalive_timethe interval between the last data packet sent (simple ACKs are not considered data) and the first keepalive probe; after the connection is marked to need keepalive, this counter is not used any furthertcp_keepalive_intvlthe interval between subsequential keepalive probes, regardless of what the connection has exchanged in the meantimetcp_keepalive_probesthe number of unacknowledged probes to send before considering the connection dead and notifying the application layer第一个参数为:闲置TCP时间,即只有闲置超过这个时间范围的TCP才会被系统去检测,默认为两个小时第二个参数:检测周期 超过第一个参数的TCP连接将接受检测,每隔 一个检测周期 去检测一次,默认75秒第三个参数:机会次数 检测周期超过这个次数,就会被服务器认为TCP连接死掉,释放。不过现在的推送服务器一般都会再做一个TCP 心跳监测机制,灵活,可控3.对心跳的一些抓包客户端对服务器心跳是通过发送一条TCP交互,正常的情况下,客户端 发送 psh&&ack 到服务器,然后服务器再返回psh&&ack,然后客户端响应ack,一来一回,消耗了将近200bytes的流量,所以这个心跳不能太频繁,后来又查找资料,google的心跳时间是1680s(实际中都是黑色的不可达包,被和谐了),微信的心跳300秒(实测不到300秒,270秒就跳了,300秒是中国2G网络的一个闲置TCP上限)。还有微信的心跳报只有一个SSL 的 continuation data包,只有82bytes,探索实现方式中。引用:http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/golang 上传文件到php作者: taililong日期: 2015年3月11日没有评论GO上传文件给PHP,第一篇文章里面少了个request.Header.Set(“Content-Type”, formcontenttype) 希望能够帮助别人func upimgAction(imgurl string, url string) {path := imgurlextraParams := map[string]string{"param1": "1","param2": "2","param3": "3",}request, err := newfileUploadRequest(url, extraParams, "Filedata", path)//Filedata文件名称if err != nil {log.Error(err)}//fmt.Println(request)resp, err := Gclient.Do(request)if err != nil {log.Error(err)} else {body := &bytes.Buffer{}_, err := body.ReadFrom(resp.Body)if err != nil {log.Error(err)}resp.Body.Close()//fmt.Println(resp.StatusCode)//fmt.Println(resp.Header)fmt.Println(body)}}func newfileUploadRequest(uri string, params map[string]string, paramName, path string) (*http.Request, error) {file, err := os.Open(path)if err != nil {return nil, err}defer file.Close()body := &bytes.Buffer{}writer := multipart.NewWriter(body)for key, val := range params {_ = writer.WriteField(key, val)}formcontenttype := writer.FormDataContentType()part, err := writer.CreateFormFile(paramName, filepath.Base(path))if err != nil {return nil, err}_, err = io.Copy(part, file)err = writer.Close()if err != nil {return nil, err}//fmt.Println(body)request, err := http.NewRequest("POST", uri, body)request.Header.Set("Content-Type", formcontenttype)return request, err}参考网站 http://matt.aimonetti.net/posts/2013/07/01/golang-multipart-file-upload-example/http://stackoverflow.com/questions/20205796/golang-post-data-using-the-content-type-multipart-form-datago 调试的一些技巧作者: taililong日期: 2015年3月4日没有评论go tool pprof http://IP:PORT/debug/pprof/profile分析CPUgo tool pprof http://IP:PORT/debug/pprof/heap分析内存一些经验(引用知乎http://www.zhihu.com/qu
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2025-08-23 21:06, Process in 0.0051 second.