Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send() is not setting the errno

Status
Not open for further replies.

antonas

Programmer
Oct 22, 2002
6
DE
Hi,

I am very new in socket programing on Unix. The problem is that it seems that send function is not setting a errno on Solaris machine or I got it wrong.

well I have
...

trace("DEBUG 0 Number of bytes returned :%d", errno);
begin = 0
while (send_len > (cur_sent = send(sock,&((char *)msg)[begin],send_len,0)))
{
trace("DEBUG 1 Number of bytes returned :%d, errno = %d",cur_sent, errno);
if ((0 > cur_sent) && ((errno != EWOULDBLOCK) &&
(errno != EAGAIN) &&
(errno != EINTR)))
{ /* check why nothing has been sent */
free(msg);
mERR_SOCKET("send",ctl_tbl[sock]->service,errno);
SYSpop();
return(AMSA02_CP_ERR);
}
if (0 > cur_sent {
cur_sent = 0;
}
send_len -= cur_sent; /* determine new length to send */
begin += cur_sent; /* determine new index of data to send */
}

Well.. And so in code above I had such a problem that send() returned -1 (only when machine had very high load) and errno was still 0. How it can happen ? , Wll I have tried to explicitly set errno to some non zero value before send() is called and anyway successful send doesnot resets errno to 0.

Please anybody can give me a hint ?

ToNy
 
hi ...

so you are sending data to a connected socket [tcp ?]
anyway, i am not sure what the problem is.

i have always used 'write' instead of 'send' and the ret_value always is meaningful.

br: nagi
 
Yes I do send to connected socket. I have send messages 500 times and it was sucesfuul and then it started fail to send it. But It happened only once or twice, when machine load was high
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top