<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: recv error: Function is not available 0 251 in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/recv-error-function-is-not-available-0-251/m-p/4038190#M93944</link>
    <description>Make sure you are compiling with the proper include files and libraries. Could you post the program here (if it isn't big) as that might help in troubleshooting it.</description>
    <pubDate>Mon, 16 Jul 2007 12:19:45 GMT</pubDate>
    <dc:creator>Sandman!</dc:creator>
    <dc:date>2007-07-16T12:19:45Z</dc:date>
    <item>
      <title>recv error: Function is not available 0 251</title>
      <link>https://community.hpe.com/t5/operating-system-linux/recv-error-function-is-not-available-0-251/m-p/4038189#M93943</link>
      <description>Hello all,&lt;BR /&gt;&lt;BR /&gt;I have a query&lt;BR /&gt;&lt;BR /&gt;i have written one small program .it will send and recv data continously.&lt;BR /&gt;My problem is:-&lt;BR /&gt;1.if i run this same program in linux .its working fine but if i run in HP-UX11iv1(PARISC) machine .i am getting following error&lt;BR /&gt;&lt;BR /&gt;"recv error: Function is not available 0 251"&lt;BR /&gt;&lt;BR /&gt;can u tell me .is it server regarding issue ? &lt;BR /&gt;how to fix this one?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Moorthy&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Jul 2007 12:13:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/recv-error-function-is-not-available-0-251/m-p/4038189#M93943</guid>
      <dc:creator>moorthyp</dc:creator>
      <dc:date>2007-07-16T12:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: recv error: Function is not available 0 251</title>
      <link>https://community.hpe.com/t5/operating-system-linux/recv-error-function-is-not-available-0-251/m-p/4038190#M93944</link>
      <description>Make sure you are compiling with the proper include files and libraries. Could you post the program here (if it isn't big) as that might help in troubleshooting it.</description>
      <pubDate>Mon, 16 Jul 2007 12:19:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/recv-error-function-is-not-available-0-251/m-p/4038190#M93944</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-07-16T12:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: recv error: Function is not available 0 251</title>
      <link>https://community.hpe.com/t5/operating-system-linux/recv-error-function-is-not-available-0-251/m-p/4038191#M93945</link>
      <description>this is my code&lt;BR /&gt;can u tell me is there any mistake&lt;BR /&gt;&lt;BR /&gt;#include&lt;IOSTREAM&gt;&lt;BR /&gt;#include&lt;SYS&gt;&lt;BR /&gt;#include&lt;SYS&gt;&lt;BR /&gt;#include&lt;NETINET&gt;&lt;BR /&gt;#include&lt;ARPA&gt;&lt;BR /&gt;#include&lt;STDLIB.H&gt;&lt;BR /&gt;#include&lt;UNISTD.H&gt;&lt;BR /&gt;#include&lt;ERRNO.H&gt;&lt;BR /&gt;#include&lt;SYS&gt;&lt;BR /&gt;#include&lt;NETDB.H&gt;&lt;BR /&gt;fd_set rd_set;&lt;BR /&gt;fd_set wr_set;&lt;BR /&gt;fd_set er_set;&lt;BR /&gt;int maxFds = 16;&lt;BR /&gt;&lt;BR /&gt;using namespace std;&lt;BR /&gt;&lt;BR /&gt;#define PKT_LEN 1124&lt;BR /&gt;#define PORT_NUM 1707&lt;BR /&gt;&lt;BR /&gt;int main ()&lt;BR /&gt;{&lt;BR /&gt; int nSocket, sockFd;&lt;BR /&gt; unsigned char *pktBuf = new unsigned char[PKT_LEN];&lt;BR /&gt; struct sockaddr_in serv, cli;&lt;BR /&gt; struct sockaddr fromAddr;&lt;BR /&gt; int fromLen = sizeof (fromAddr);&lt;BR /&gt; int clilen = sizeof (cli);&lt;BR /&gt;     &lt;BR /&gt; int bytesReceived;&lt;BR /&gt; int pktsRecvd = 1;&lt;BR /&gt; int pktsSent = 1;&lt;BR /&gt; int selRet;&lt;BR /&gt;//  struct protoent *ptent;&lt;BR /&gt;// &lt;BR /&gt;//  ptent = getprotobyname ("TCP");&lt;BR /&gt;//  printf ("TCP PROTOCOL No. %d - %s\n", ptent-&amp;gt;p_proto, ptent-&amp;gt;p_name);&lt;BR /&gt; if ( (nSocket = socket(AF_INET, SOCK_STREAM, 6)) &amp;lt; 0)  {&lt;BR /&gt;  perror ("socket error");&lt;BR /&gt;  return -1;&lt;BR /&gt; }&lt;BR /&gt; cout &amp;lt;&amp;lt; "Socket# " &amp;lt;&amp;lt; nSocket &amp;lt;&amp;lt; endl;&lt;BR /&gt;&lt;BR /&gt; memset(&amp;amp;serv, 0, sizeof(serv));&lt;BR /&gt; serv.sin_family      = AF_INET;&lt;BR /&gt; serv.sin_addr.s_addr = htonl(INADDR_ANY);&lt;BR /&gt; serv.sin_port        = htons(PORT_NUM);&lt;BR /&gt;&lt;BR /&gt; if (bind(nSocket,  (struct sockaddr *)&amp;amp;serv, sizeof(serv)) &amp;lt; 0)  {&lt;BR /&gt;  perror ("bind error");&lt;BR /&gt;  return -1;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; if (listen(nSocket, SOMAXCONN) &amp;lt; 0)  {&lt;BR /&gt;  perror ("listen error");&lt;BR /&gt;  return -1;&lt;BR /&gt; }&lt;BR /&gt;//clilen = sizeof(cli); &lt;BR /&gt;if ((sockFd = accept(nSocket, (struct sockaddr *)&amp;amp;cli,(socklen_t *)&amp;amp;clilen )) &amp;lt; 0)  {&lt;BR /&gt;  perror ("accept error");&lt;BR /&gt;  return -1;&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt; FD_ZERO (&amp;amp;rd_set);&lt;BR /&gt; FD_ZERO (&amp;amp;wr_set);&lt;BR /&gt; FD_ZERO (&amp;amp;er_set);&lt;BR /&gt;&lt;BR /&gt; FD_SET (sockFd, &amp;amp;rd_set);&lt;BR /&gt; // FD_SET (sockFd, &amp;amp;wr_set);&lt;BR /&gt; // FD_SET (sockFd, &amp;amp;er_set);&lt;BR /&gt;&lt;BR /&gt; while (1)&lt;BR /&gt; {&lt;BR /&gt;&lt;BR /&gt;//   if ((bytesReceived = recvfrom (sockFd, pktBuf, 1024,&lt;BR /&gt;//         0, &amp;amp;fromAddr, &amp;amp;fromLen)) &amp;lt;= 0)&lt;BR /&gt;  if ((selRet = select (maxFds, &amp;amp;rd_set, &amp;amp;wr_set, &amp;amp;er_set, NULL)) &amp;lt; 0)&lt;BR /&gt;  {&lt;BR /&gt;   perror ("select error");&lt;BR /&gt;   return -1;&lt;BR /&gt;  }&lt;BR /&gt;  cout &amp;lt;&amp;lt; "Select returned - " &amp;lt;&amp;lt; selRet &amp;lt;&amp;lt; endl;&lt;BR /&gt;&lt;BR /&gt;  cout &amp;lt;&amp;lt; "Checking if Error is set...";&lt;BR /&gt;  if (FD_ISSET (sockFd, &amp;amp;er_set))&lt;BR /&gt;  {&lt;BR /&gt;   perror ("socket error");&lt;BR /&gt;   return -1;&lt;BR /&gt;  }&lt;BR /&gt;  cout &amp;lt;&amp;lt; " No error\n";&lt;BR /&gt;&lt;BR /&gt;  cout &amp;lt;&amp;lt; "Checking if Read is set...";&lt;BR /&gt;  if (FD_ISSET (sockFd, &amp;amp;rd_set))&lt;BR /&gt;  {&lt;BR /&gt;   cout &amp;lt;&amp;lt; " Reading\n";&lt;BR /&gt;   if ((bytesReceived = recv (sockFd, pktBuf, PKT_LEN, 0)) &amp;lt;= 0)&lt;BR /&gt;   {&lt;BR /&gt;    perror ("recv error");&lt;BR /&gt;    cout &amp;lt;&amp;lt; bytesReceived &amp;lt;&amp;lt; " " &amp;lt;&amp;lt; errno &amp;lt;&amp;lt; endl;&lt;BR /&gt;    return -1;&lt;BR /&gt;   }&lt;BR /&gt;   cout &amp;lt;&amp;lt; bytesReceived &amp;lt;&amp;lt; " Bytes reveived\n";&lt;BR /&gt;   cout &amp;lt;&amp;lt; "recvd pkt no. - " &amp;lt;&amp;lt; pktsRecvd++ &amp;lt;&amp;lt; endl;&lt;BR /&gt;   FD_CLR (sockFd, &amp;amp;rd_set);&lt;BR /&gt;   FD_SET (sockFd, &amp;amp;wr_set);&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;  cout &amp;lt;&amp;lt; "Checking if Write is set...";&lt;BR /&gt;  if (FD_ISSET (sockFd, &amp;amp;wr_set))&lt;BR /&gt;  {&lt;BR /&gt;   fromLen = sizeof (fromAddr);&lt;BR /&gt;   cout &amp;lt;&amp;lt; " Writing\n";&lt;BR /&gt;   if (send (sockFd, (const void *)pktBuf, bytesReceived, 0) != bytesReceived)&lt;BR /&gt;   {&lt;BR /&gt;    perror ("send error");&lt;BR /&gt;    return -1;&lt;BR /&gt;   }&lt;BR /&gt;   cout &amp;lt;&amp;lt; "sent pkt no. - " &amp;lt;&amp;lt; pktsSent++ &amp;lt;&amp;lt; endl;&lt;BR /&gt;   FD_CLR (sockFd, &amp;amp;wr_set);&lt;BR /&gt;   FD_SET (sockFd, &amp;amp;rd_set);&lt;BR /&gt;  }&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;&lt;/NETDB.H&gt;&lt;/SYS&gt;&lt;/ERRNO.H&gt;&lt;/UNISTD.H&gt;&lt;/STDLIB.H&gt;&lt;/ARPA&gt;&lt;/NETINET&gt;&lt;/SYS&gt;&lt;/SYS&gt;&lt;/IOSTREAM&gt;</description>
      <pubDate>Tue, 17 Jul 2007 00:54:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/recv-error-function-is-not-available-0-251/m-p/4038191#M93945</guid>
      <dc:creator>moorthyp</dc:creator>
      <dc:date>2007-07-17T00:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: recv error: Function is not available 0 251</title>
      <link>https://community.hpe.com/t5/operating-system-linux/recv-error-function-is-not-available-0-251/m-p/4038192#M93946</link>
      <description>&lt;!--!*#--&gt;if ((bytesReceived = recv (sockFd, pktBuf, PKT_LEN, 0)) &amp;lt;= 0) {&lt;BR /&gt;   perror ("recv error");&lt;BR /&gt;   cout &amp;lt;&amp;lt; bytesReceived &amp;lt;&amp;lt; " " &amp;lt;&amp;lt; errno &amp;lt;&amp;lt; endl;&lt;BR /&gt;&lt;BR /&gt;Your error checking on this code is bad.  If recv returns 0, you must not call perror nor print errno.&lt;BR /&gt;&lt;BR /&gt;recv(2) says it returns 0 for:&lt;BR /&gt;The socket is blocking and the transport connection to the&lt;BR /&gt;remote node failed, or the remote side of a connection-based&lt;BR /&gt;socket has performed an orderly shutdown and there is no&lt;BR /&gt;more data to read (the socket has reached the end of its&lt;BR /&gt;data stream).  Sockets with the O_NDELAY flag set may also&lt;BR /&gt;return 0 at any time when there is no data available.&lt;BR /&gt;</description>
      <pubDate>Tue, 17 Jul 2007 02:59:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/recv-error-function-is-not-available-0-251/m-p/4038192#M93946</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-07-17T02:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: recv error: Function is not available 0 251</title>
      <link>https://community.hpe.com/t5/operating-system-linux/recv-error-function-is-not-available-0-251/m-p/4038193#M93947</link>
      <description>thank u sir.&lt;BR /&gt; i will check it and come back to u&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;moorthy.p</description>
      <pubDate>Tue, 17 Jul 2007 04:19:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/recv-error-function-is-not-available-0-251/m-p/4038193#M93947</guid>
      <dc:creator>moorthyp</dc:creator>
      <dc:date>2007-07-17T04:19:07Z</dc:date>
    </item>
  </channel>
</rss>

