<?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: connect in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/connect/m-p/4603312#M679779</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;What you have shown doesn't reveal the signal handler code.  For that matter, the 'connect()' normally blocks (waits) until satisfied.  You could use a non-blocking connection and periodically retry until you are interrupted or achieve a successful connection.&lt;BR /&gt;&lt;BR /&gt;See the manpages for 'connect(2)' for more information.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Thu, 18 Mar 2010 12:54:55 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2010-03-18T12:54:55Z</dc:date>
    <item>
      <title>connect</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/connect/m-p/4603311#M679778</link>
      <description>Hello all,&lt;BR /&gt;&lt;BR /&gt;I have met the following problem in managing "connect" function.&lt;BR /&gt;&lt;BR /&gt;To manage the case in which the remote host is not available, I have written the following code:&lt;BR /&gt;  &lt;BR /&gt;alarm(1);&lt;BR /&gt;&lt;BR /&gt;err = connect(....);&lt;BR /&gt;&lt;BR /&gt;alarm(0);&lt;BR /&gt;&lt;BR /&gt;so, if the remote node is not available the connect will be interrupted from incoming SIGALRM and the err variable is set to 4.&lt;BR /&gt;&lt;BR /&gt;Now, in some cases such a mechanism doesn't work and the connect terminates only when its time out expires (errno = 238 - Connection timed out)&lt;BR /&gt;&lt;BR /&gt;Which could be the reason?&lt;BR /&gt;Do you see any weakness in this procedure?&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance&lt;BR /&gt;&lt;BR /&gt;Giuseppe&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Mar 2010 12:40:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/connect/m-p/4603311#M679778</guid>
      <dc:creator>Fedele Giuseppe</dc:creator>
      <dc:date>2010-03-18T12:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: connect</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/connect/m-p/4603312#M679779</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;What you have shown doesn't reveal the signal handler code.  For that matter, the 'connect()' normally blocks (waits) until satisfied.  You could use a non-blocking connection and periodically retry until you are interrupted or achieve a successful connection.&lt;BR /&gt;&lt;BR /&gt;See the manpages for 'connect(2)' for more information.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 18 Mar 2010 12:54:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/connect/m-p/4603312#M679779</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-03-18T12:54:55Z</dc:date>
    </item>
    <item>
      <title>Re: connect</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/connect/m-p/4603313#M679780</link>
      <description>Hi, this it the signal handling code:&lt;BR /&gt;&lt;BR /&gt;sigemptyset(&amp;amp;signalAction.sa_mask);&lt;BR /&gt;signalAction.sa_flags = 0;&lt;BR /&gt;signalAction.sa_handler = SigExit;&lt;BR /&gt;....&lt;BR /&gt;sigaction(SIGALRM,&amp;amp;signalAction, NULL);&lt;BR /&gt;&lt;BR /&gt;where:&lt;BR /&gt;&lt;BR /&gt;void SigExit(int sig)&lt;BR /&gt;{&lt;BR /&gt;  switch(sig)&lt;BR /&gt;  {&lt;BR /&gt;    case SIGALRM:&lt;BR /&gt;      return;&lt;BR /&gt;    break;&lt;BR /&gt;  }&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Mar 2010 13:19:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/connect/m-p/4603313#M679780</guid>
      <dc:creator>Fedele Giuseppe</dc:creator>
      <dc:date>2010-03-18T13:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: connect</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/connect/m-p/4603314#M679781</link>
      <description>Hi Giuseppe:&lt;BR /&gt;&lt;BR /&gt;I think you want select(), with the timeout set to one second.&lt;BR /&gt;&lt;BR /&gt;I would avoid a signal handler in this procedure, the select function is what I'd go with.&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;  Dave Johns&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Mar 2010 13:55:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/connect/m-p/4603314#M679781</guid>
      <dc:creator>David Johns</dc:creator>
      <dc:date>2010-03-18T13:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: connect</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/connect/m-p/4603315#M679782</link>
      <description>To use select() (or poll(), or eventports) with connect(), one would need to put the socket into non-blocking mode, make the connect() call and then go into select() (et al) for ones timeout length, waiting for the socket to become writable.&lt;BR /&gt;&lt;BR /&gt;Is this a single, or a multi-threaded program?</description>
      <pubDate>Thu, 18 Mar 2010 23:29:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/connect/m-p/4603315#M679782</guid>
      <dc:creator>rick jones</dc:creator>
      <dc:date>2010-03-18T23:29:43Z</dc:date>
    </item>
  </channel>
</rss>

