Issue 5: mssend crashes matlab
Status:  New
Owner: ----
Reported by den.kov...@gmail.com, Sep 18, 2010
What steps will reproduce the problem?
1. Server: srvsock=mslisten(3000); sock=msaccept(srvsock);
2. Client: sock=msconnect('localhost',3000); msclose(sock);
3. Server: mssend(sock,3);

What is the expected output? What do you see instead?
Expected output: nothing
Instead, matlab dies on SIGPIPE.

What version of the product are you using? On what operating system?
1.0

Please provide any additional information below.
When the client closes the socket while we are sending, send triggers a SIGPIPE.
A simple solution is to make sure SIGPIPEs are ignored while we are trying to send:

    typedef void (*sig_t) (int);
    sig_t oldSigHandler = signal(SIGPIPE, SIG_IGN);
    if (oldSigHandler==SIG_ERR)
    {
        perror("signal");
        return;
    }

After this, before we return anywhere, we can revert to the SIGPIPE handler set by matlab:

    signal(SIGPIPE, oldSigHandler);
    return;