My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 5: mssend crashes matlab
1 person starred this issue and may be notified of changes. Back to list
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;


Powered by Google Project Hosting