Am 10.12.2012 19:53, schrieb Tommi Mäkitalo:
Am 10.12.2012 09:03, schrieb Denis Loh:
Hi Tommi,
a user reported, that my application crashed, when he tried to open a
stream with his PS3. I googled a bit and found out, that some clients
close the stream disruptively causing the TCP stream to signal a
broken pipe. As most of my clients work fine and I cannot reproduce
this error, I was hopping, that you could help me.
Hi Denis,
you must always call "::signal(SIGPIPE, SIG_IGN);" in your
application. If the peer closes the connection and you try to write to
the socket, your application gets a SIGPIPE. And default action is to
stop the application. If you set the signal handler to SIG_IGN to
ignore the signal, you get just an eof when writing.
The signal is set to SIG_IGN in the http server, jsonrcp server,
binary rpc server and tntnet. But if you just use the network classes,
you have to do it for your own.
A strong advise in the API documentation would be really helpful (just
as a reminder for me).
Tommi
Hi Tommi,
I added the signal handler here:
::signal(SIGPIPE, SIG_IGN);
mApplication.listen(mListenerAddress.c_str(), mListenerPort);
This is right before the application runs the server. However, it does
not work either. Additionally, I saw, that you already ignoring SIGPIPE
signals in Tntnet::run(). Why can those signals still cause the
application to crash? Do I have to put the handler to the components?
Thanks again.
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general