gdb结合coredump定位崩溃进程
内核模块编译

unix domain socket相关

lazycat posted @ 2012年2月13日 15:33 in linux , 2685 阅读

1.关于SIGPIPE信号

今天测试代码发现,当已经建立了Stream连接的DomainSocket的服务端进程终止后,客户端进程调用send函数导致客户端进程也退出了的情况。

上网搜了一下,发现是客户端进程收到了一个SIGPIPE信号,信号默认的执行动作是终止退出。

解决办法应该是使用

 

signal(SIGPIPE, SIG_IGN);

忽略SIGPIPE信号。

这样在断开连接后,还继续调用send的情况下,会返回-1,错误号为EPIPE(Broken pipe)。

PS:在recv(sock, ...) 得到返回值为0的时候表示连接断开,这时候应该调用close(sock)来保证后续不会出现问题。

相关链接:

http://www.cppblog.com/elva/archive/2008/09/10/61544.html

http://stackoverflow.com/questions/108183/how-to-prevent-sigpipes-or-handle-them-properly

Avatar_small
maid services dubai 说:
2019年9月14日 15:25

Regardless if you own/rent your private home or contain property rentals that you really lease over, cleanliness is extremely important. What type janitorial services are accessible? When it pertains cleaning, reputation is extremely important. You want to pinpoint a service which you could count now on to clean while not stealing, since cleaning more often then not takes set when owners or individuals are over. The maintaining supplies that can be used also are important. You desire to be sure oftentimes Eco-friendly and even safe designed for kids (and even pets if and when they are left).

Avatar_small
www.easterniowanews. 说:
2019年11月13日 17:25

There are available a time in your rapport where you ought to make any transition with just seeing to from a technical perspective being from a relationship. If you think maybe like you with your partner prepared in a good direction, you should take it to another location level.

Avatar_small
atlanta black busine 说:
2020年3月19日 19:08

Home business list really are compiled and additionally updated each month with help of sources that include yellow pages and posts directories, business credit lines, annual assessments, business and additionally industry web sites, and telephone number verification.

Avatar_small
freeze business rate 说:
2020年3月19日 19:08

Word wide web Buisness, affiliate promotion and weblog all set off together certainly. In precise, you may well add txt links for the blog reports. These connections will snap your document viewer by way of your web page for any affiliate technique.

Avatar_small
shawcor success 说:
2020年3月19日 19:08

Once you hate standing up that morning and preparing to work for a different inividual, then upper body and finally an internet home business. People execute this for many different reasons, like being along with the kids or even a transformation of existence.

Avatar_small
river bank marketing 说:
2020年3月19日 19:09

Internet Marketing is mostly a broad term together with advertising, supporting, and strengthening unique presence about businesses with digital types. Some for the digital hints that are categorized as the outdoor patio umbrella of 'Digital Marketing' really are digital endorsing, email promotional, content promotional, pay-per-click, via the internet brochures, and better.

Avatar_small
siberyan health 说:
2020年3月19日 19:09

Elementary and Imperative Health Packages - A top-notch-quality timber a limited health care benefit during a considerably poor insurance amount. In selecting such type of health insurance plan, it is necessary that you ought to read all the policy profile giving special concentration on covered offerings. There really are plans which may not cover up on a lot of basic applications, certain medical-related services that include chemotherapy, maternal dna care or possibly certain medications.

Avatar_small
maids in dubai 说:
2020年4月28日 18:54

Once you hire any servant maid to completely clean you house or office, you are usually permitting her to gain access to to your own personal belongings. Thus before signing up a cleaning service, you must ask specific questions to discover more regarding her backdrop information and also personal experience. First factor is in which, you must inquire friends and family, relatives or perhaps acquaintances for personal experience with all the servant maids.

Avatar_small
painters in Dubai 说:
2020年4月28日 18:55

In order to give your property a certain form of atmosphere, then internal paints have become important. The paints that you choose offer either heat or coolness for the rooms of your property and if you would like to paint oneself or retain the services of house painters; keep at heart there are many ideas so that you can consider. These tips include choosing things including the right color, colors, colors, schemes, shade methods, and also other related factors.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter