读取带有错误ENOMEM返回的套接字时,这怎么可能发生 [英] How could this happen when reading a socket with a error ENOMEM return

查看:88
本文介绍了读取带有错误ENOMEM返回的套接字时,这怎么可能发生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当读取错误ENOMEM return的套接字时,这怎么可能发生?Man 2阅读,我看不到有关此错误的任何详细信息,有人可以帮助我.谢谢.我的Linux内核2.6.26-1-686.

How could this happen when reading a socket with a error ENOMEM return ? Man 2 read, I can't see any detail about this error, can someone help me. Thanks. My linux kernel 2.6.26-1-686.

推荐答案

ENOMEM

是kern/include/kern/errno.h中定义的OS错误代码,由于内存不足而返回.

is an OS error code , as defined in kern/include/kern/errno.h ,which is returned due to insufficient memory.

名称ENOMEM代表错误NO MEMory .它是fork()调用返回的错误代码之一,表示没有可用的存储空间.与套接字相关联,如果没有足够的可用资源来创建套接字,则会引发套接字错误.错误代码的值为12.

The name ENOMEM stands for Error NO MEMory. Its one of the error codes returned by the fork() call which means no more storage space available.In connection with sockets they are raised when there isn’t enough resources available to create a socket. The value of the error code is 12.

您可以立即处理此错误并尽快释放所有分配的资源,避免需要分配新资源的操作.

You can handle this error by instantly and to release all the allocated resources as soon as possible, avoiding operations requiring allocating new resources.

从套接字读取会导致分配接收数据缓冲区,并且在您需要后需要释放它们.还要确保有足够的内存.内存分配失败时,它将返回此错误.参见链接

Reading from socket cause allocation for receive data buffer and they needs to be free after your requirement. Also make sure enough memory is there. It will return this error when fail in allocation of memory. See link

这篇关于读取带有错误ENOMEM返回的套接字时,这怎么可能发生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆