[Ace-users] [ace-users] Why send() cause a SIGPIPE rather than	returning -1	with ECONNRESET
    Douglas C. Schmidt 
    schmidt at dre.vanderbilt.edu
       
    Fri Jan 11 13:36:11 CST 2008
    
    
  
Hi,
> My problem occurs in linux socket API.  I am not sure whether it
> occurs in ACE.
You are correct - this is a UNIX/Linux socket API issue, not an ACE
issue.  Please make sure to post these sorts of questions to a
UNIX/Linux newsgroup, comp.unix.questions, rather than to
comp.soft-sys.ace.
>In linux, I have codes below:
>
>//client
>
> char buf[1024*1024];
> int n = send(sockfd, buf, 1024*1024, 0);    //the first send()
> n = send(sockfd, buf, 1024, 0);             //the second send()
>
> The first send() should block for a while. If client receives  an RST
>from server when send() is blocking,  the first send() returns a
>number less than 1024*1024. However, sometimes the second send() will
>cause a SIGPIPE signal or sometimes it return -1 with a ECONNRESET
>error rather than SIGPIPE.
>
> Why? 
Because that's the way that the semantics of send() are defined.
Please take a look at a good book or website on the socket API.
Here's a place to start:
http://www.retran.com/beej/sendman.html
Take care,
     Doug
-- 
Dr. Douglas C. Schmidt                       Professor and Associate Chair
Electrical Engineering and Computer Science  TEL: (615) 343-8197
Vanderbilt University                        WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203                          NET: d.schmidt at vanderbilt.edu
    
    
More information about the Ace-users
mailing list