errno

Linux(CentOS 5.5)安装Apache 2.2.3

折月煮酒 提交于 2019-12-25 03:38:04
今天本来打算安装在Linux下安装httpd-2.2.16.tar.bz2。 从网站下载压缩包,然后开始安装: 以 Tar.bz2 为扩展名的软件包,是用Tar程序打包并用Bzip2程序进行压缩的软件包。它的优点是压缩率非常高,需要使用 “bunzip2 httpd-2.2.16.tar.bz2”进行解压。 然后cd 到解压后的目录 然后执行tar xvf httpd-2.2.16.tar ./configure --prefix=/usr/local/apache --enable-so 设置安装目录和参数设置 /usr/local/apache 为设置得安装目录 执行,结果出现报错: configure: error: no acceptable C compiler found in $PATH 网上查找资料,说是少了gcc包,需要从安装盘上找如下包安装: libf2c-3.3.2-1.i386.rpm libstdc++-devel-3.3.2-1.i386.rpm glibc-kernheaders-2.4-8.36.i386.rpm glibc-headers-2.3.2-101.i386.rpm glibc-devel-2.3.2-101.i386.rpm gcc-objc-3.3.2-1.i386.rpm binutils-2.14.90.0.6-3.i386

网络通信 --> socket通信

倖福魔咒の 提交于 2019-12-24 20:52:29
socket通信    socket是应用层与 TCP/IP协议族通信的中间软件抽象层,是一组接口。 工作原理如下:    具体过程 :服务器端先初始化s ocket,然后与端口绑定 (bind),对端口进行监听 (listen),调用 accept阻塞,等待客户端连接。在这时如果有个客户端初始化一个s ocket ,然后连接服务器 (connect),如果连接成功,这时客户端与服务器端的连接就建立了。客户端发送数据请求,服务器端接收请求并处理请求,然后把回应数据发送给客户端,客户端读取数据,最后关闭连接,一次交互结束。 socket属性 1.创建套接字   套接字的特性由三个属性确定:域(domain), 类型(type)和协议(protocol)。 int socket(int domain, int type, int protocol);     domain :指定socket的类型,一般为AF_INET;    type :是SOCK_STREAM 或SOCK_DGRAM,分别表示TCP连接和UDP连接;    protocol :通常赋值"0"。 socket()调用返回一个整型socket描述符,你可以在后面的调用使用它。 2.命名套接字 int bind(int sockfd, const struct sockaddr *addr, socklen_t

Why does Python's argparse use an error code of 2 for SystemExit?

最后都变了- 提交于 2019-12-24 11:15:06
问题 When I give Python's argparse input it doesn't like, it raises a SystemExit with a code of 2, which seems to mean "No such file or directory". Why use this error code? import argparse import errno parser = argparse.ArgumentParser() parser.add_argument('arg') try: parser.parse_args([]) except SystemExit as se: print("Got error code {} which is {} in errno" .format(se.code, errno.errorcode[se.code])) produces this output: usage: se.py [-h] arg se.py: error: too few arguments Got error code 2

Unix domain socket

青春壹個敷衍的年華 提交于 2019-12-24 00:11:22
转载:http://www.cnblogs.com/chekliang/p/3222950.html socket API原本是为网络通讯设计的,但后来在socket的框架上发展出一种IPC机制,就是UNIX Domain Socket。 虽然网络socket也可用于同一台主机的进程间通讯(通过loopback地址127.0.0.1),但是UNIX Domain Socket用于IPC更有效率:不需要经过网络协议栈,不需要打包拆包、计算校验和、维护序号和应答等,只是将应用层数据从一个进程拷贝到另一个进程。 这是因为,IPC机制本质上是可靠的通讯,而网络协议是为不可靠的通讯设计的。UNIX Domain Socket也提供面向流和面向数据包两种API接口,类似于TCP和UDP,但是面向消息的UNIX Domain Socket也是可靠的,消息既不会丢失也不会顺序错乱。   UNIX Domain Socket是全双工的,API接口语义丰富,相比其它IPC机制有明显的优越性,目前已成为使用最广泛的IPC机制,比如X Window服务器和GUI程序之间就是通过UNIX Domain Socket通讯的。   使用UNIX Domain Socket的过程和网络socket十分相似,也要先调用socket()创建一个socket文件描述符,address family指定为AF_UNIX

Bind error (99): Cannot assign requested address

你离开我真会死。 提交于 2019-12-23 12:57:29
问题 I am trying to get the following piece of code working but receiving the above error. I am reasonably sure that the address I am putting in is correct because it works in a separate program which is doing a similar task. This leads me to believe I am making some sort of silly mistake, any help would be appreciated! /*Create TCP socket*/ int tcp_socket(void) { int s; while((s = socket(PF_INET,SOCK_STREAM,0))==-1 && errno == EINTR){ continue; } return s; } /*Bind tcp*/ int tcp_bind(int s, char

Are Python error numbers associated with IOError stable?

佐手、 提交于 2019-12-23 10:14:12
问题 I want to move a file, but in the case it is not found I should just ignore it. In all other cases the exception should be propagated. I have the following piece of Python code: try: shutil.move(old_path, new_path) except IOError as e: if e.errno != 2: raise e errno == 2 is the one, that has 'No such file or directory' description. I wonder if this is stable across Python versions and platforms, and etc. 回答1: It is better to use values from the errno module instead of hardcoding the value 2 :

TCP编程函数和步骤

元气小坏坏 提交于 2019-12-23 03:44:37
TCP编程的 服务器端 一般步骤是 1、 创建一个socket,用函数socket(); 2、 设置socket属性,用函数setsockopt(); * 可选 3、 绑定IP地址、端口等信息到socket上,用函数bind(); 4、 开启监听,用函数listen(); 5、 接收客户端上来的连接,用函数accept(); 6、 收发数据,用函数send()和recv(),者read()和write(); 7、 关闭网络连接; 8、 关闭监听; TCP编程的 客户端 一般步骤是: 1、 创建一个socket,用函数socket(); 2、 设置socket属性,用函数setsockopt();* 可选 3、 绑定IP地址、端口等信息到socket上,用函数bind();* 可选 4、 设置要连接的对方的IP地址和端口等属性; 5、 连接服务器,用函数connect(); 6、 收发数据,用函数send()和recv(),或者read()和write(); 7、 关闭网络连接; UDP编程的服务器端一般步骤是: 1、 创建一个socket,用函数socket(); 2、 设置socket属性,用函数setsockopt();* 可选 3、 绑定IP地址、端口等信息到socket上,用函数bind() 4、 循环接收数据,用函数recvfrom(); 5、 关闭网络连接;

Tnesorboard:PermissionError: [Errno 13] Permission denied: '/tmp/.tensorboard-info/pid-20281.info'

こ雲淡風輕ζ 提交于 2019-12-23 02:58:22
运行TensorBoard时出现权限错误: PermissionError: [Errno 13] Permission denied: '/tmp/.tensorboard-info/pid-20281.info' 参考文章: https://www.jianshu.com/p/9fa5022ebe10 https://github.com/tensorflow/tensorboard/issues/2010#issuecomment-484605529 错误原因请见上面两篇参考 解决方案: 命令行运行 export TMPDIR=/tmp/$USER; # 可通过cd /tmp/$USER查看上述语句的含义 mkdir -p $TMPDIR; 再运行正常的tensorboard程序: tensorboard --logdir $LOGDIR 来源: CSDN 作者: R.X.Geng 链接: https://blog.csdn.net/qazwsxrx/article/details/103652963

Simple messaging application…getting errno 14: bad address

依然范特西╮ 提交于 2019-12-22 07:50:12
问题 I am writing a simple messaging application in C using sockets. When I use function recvfrom , it returns -1 and sets errno = 14 which is Bad address (which I am printing at the end). The strange thing is that it still reads from the socket and gets the correct message. That is, the application is working perfectly and as expected except for that error. My question is this: Why do you think I am getting this error? I cannot think of any reason. I was using inet_pton to set peer->sin_addr but

Simple messaging application…getting errno 14: bad address

十年热恋 提交于 2019-12-22 07:50:10
问题 I am writing a simple messaging application in C using sockets. When I use function recvfrom , it returns -1 and sets errno = 14 which is Bad address (which I am printing at the end). The strange thing is that it still reads from the socket and gets the correct message. That is, the application is working perfectly and as expected except for that error. My question is this: Why do you think I am getting this error? I cannot think of any reason. I was using inet_pton to set peer->sin_addr but