Archive

Archive for the ‘c’ Category

windows7 不支持 AllocateAndGetTcpExTableFromStack

August 8th, 2010 陈毓端 No comments

周末把开发的集成软件放在windows7环境中测试,发现iphlpapi.dll 在windows7下已经放弃支持AllocateAndGetTcpExTableFromStack,AllocateAndGetUdpExTableFromStack

没用办法只能重新修改程序进行重新编译

只能改用 GetExtendedTcpTable 。

具体参考:

http://msdn.microsoft.com/en-us/library/aa365928(VS.85).aspx

Categories: c, delphi, java, 编程语言 Tags:

深入研究FastCGI 第一步

June 25th, 2010 陈毓端 No comments
说道FastCGI 大家都觉得它比CGI的效率高 具体高在那?很多人会说CGI需要不断的fork 对系统压力大。
其实第一次接触FastCGI是在应用Nginx环境时候,今天再次理下FastCGI 到底是什么?
从官方(http://www.fastcgi.com)的About FastCGI
第一句话就告诉我们:
FastCGI is simple because it is actually CGI with only a few extensions.
FastCGI 其实是一些简单CGI的扩展
Like CGI, FastCGI is also language-independent. For instance, FastCGI provides a way to improve the performance of the thousands of Perl applications that have been written for the Web.
如CGI ,FastCGI也具备语言无关系性。例如,FastCGI 提供一种的方法来提高Prel应用程序的处理能力。
既然是简单的CGI扩展那它的优势在那呢? 难道又是所谓的“重复造车”?
再看看官方的一句重要的解释
Like CGI, FastCGI runs applications in processes isolated from the core Web server, which provides greater security than APIs. (APIs link application code into the core Web server, which means that a bug in one API-based application can corrupt another application or the core server; a malicious API-based application can, for example, steal key security secrets from another application or the core server.)
如CGI , FastCGI 独立运行于WEB服务器的核心进程。并提供大量的安全API。 后面的英文我觉得说的有点严肃。它告诉我们一个问题,FastCGI出现问题之后,以至于不会破坏WEB server的核心进程,一句话WEB server 还可以使用脱离FastCGI的应用。
简单的说就是某些核心应用的托管。 如 托管 Nginx的PHP 解析器进程。
spawn-fcgi.c的核心代码
static int fcgi_spawn_connection(char *appPath, char **appArgv, char *addr, unsigned short port, const char *unixsocket, int fork_count, int child_count, int pid_fd, int nofork);
static int find_user_group(const char *user, const char *group, uid_t *uid, gid_t *gid, const char **username);
最近真的要看看里面的代码。
Nginx的fast-cgi 源码在: src/http/modules/ngx_http_fastcgi_module.c  可以详细的研究下,再次鞭策自己。
FastCGI 的API文档:http://www.fastcgi.com/drupal/node/5
Categories: c, linux, 编程语言 Tags:

mmseg 安装错误 error: ’strncmp’ was not declared in this scope

October 13th, 2009 陈毓端 No comments

mmseg 安装错误

  1. css/UnigramCorpusReader.cpp: In member function 'virtual int css::UnigramCorpusReader::open(const char*, const char*)':
  2. css/UnigramCorpusReader.cpp:89: error: 'strncmp' was not declared in this scope
  3. make[2]: *** [UnigramCorpusReader.lo] Error 1
  4. make[2]: Leaving directory `/lamp/mmseg-0.7.3/src'
  5. make[1]: *** [all-recursive] Error 1
  6. make[1]: Leaving directory `/lamp/mmseg-0.7.3'
  7. make: *** [all] Error 2

解决办法

  1. vim src/css/UnigramCorpusReader.cpp

添加

  1. #include <string.h>

ok!

Categories: c, linux Tags: