<?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: Fortran TCP/IP Programming Examples? in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621833#M39850</link>
    <description>&lt;!--!*#--&gt;Had a problem with the web. retry&lt;BR /&gt;structure /address/&lt;BR /&gt; union&lt;BR /&gt;  map&lt;BR /&gt;   integer*4 l_address&lt;BR /&gt;  end map&lt;BR /&gt;  map&lt;BR /&gt;   byte b_addr(4)&lt;BR /&gt;  end map&lt;BR /&gt; end union&lt;BR /&gt;end structure&lt;BR /&gt;record /adress/address&lt;BR /&gt;c&lt;BR /&gt;c now fill address.b_addr(1..4)with the bytes&lt;BR /&gt;c and then sin$l_addr= address.l_address</description>
    <pubDate>Thu, 22 Apr 2010 12:30:32 GMT</pubDate>
    <dc:creator>Fekko Stubbe</dc:creator>
    <dc:date>2010-04-22T12:30:32Z</dc:date>
    <item>
      <title>Fortran TCP/IP Programming Examples?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621828#M39845</link>
      <description>I found a Fortran TCP/IP example in an "Ask the Wizard" from July 1999.  Using that example I am trying to store an IP address into a sin$l_addr. If I store a value greater than 127 in the fourth octet (see D in the example) I get an integer overflow error. My operating system is OpenVMS 8.3-1H1 and the compiler is FORTRAN V8.0-1.</description>
      <pubDate>Wed, 21 Apr 2010 16:58:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621828#M39845</guid>
      <dc:creator>Darlene Riddle</dc:creator>
      <dc:date>2010-04-21T16:58:31Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran TCP/IP Programming Examples?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621829#M39846</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;Ah, I see.&lt;BR /&gt;&lt;BR /&gt;You are using the example from&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/wizard/wiz_2777.html" target="_blank"&gt;http://h71000.www7.hp.com/wizard/wiz_2777.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;And it is probably dying on the clumsy sign-bit protection for the byte swap      &lt;BR /&gt;:&lt;BR /&gt;        c = bytes(3)&lt;BR /&gt;        d = bytes(4)&lt;BR /&gt;        if (a .lt. 0) a = a + 256&lt;BR /&gt;        if (b .lt. 0) b = b + 256&lt;BR /&gt;:&lt;BR /&gt;&lt;BR /&gt;bytes is declared as INTEGER*1 but should be BYTE ?&lt;BR /&gt;&lt;BR /&gt;You probably also want to fix 'htons' to use BYTE variables in an equivalence instead of signed math to switch bytes.&lt;BR /&gt;&lt;BR /&gt;There are existing functions for this! (somewhere)&lt;BR /&gt;&lt;BR /&gt;Sorry, no Fortran/Ucx  compile environment handy to try.&lt;BR /&gt;&lt;BR /&gt;Be sure to search for "unsigned" in:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/doc/82final/6443/6443pro_009.html" target="_blank"&gt;http://h71000.www7.hp.com/doc/82final/6443/6443pro_009.html&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Apr 2010 17:37:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621829#M39846</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-04-21T17:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran TCP/IP Programming Examples?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621830#M39847</link>
      <description>The proper way to move data between dissimilar types in modern Fortran (not VAX and not using /OLD_F77 on Alpha) is with the transfer intrinsic function:&lt;BR /&gt;&lt;BR /&gt;dest = TRANSFER(source, mold)&lt;BR /&gt;&lt;BR /&gt;so in your case it would be&lt;BR /&gt;&lt;BR /&gt;a=transfer(bytes(3), a)&lt;BR /&gt;b=transfer(bytes(4), a)&lt;BR /&gt;&lt;BR /&gt;etc.</description>
      <pubDate>Wed, 21 Apr 2010 18:09:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621830#M39847</guid>
      <dc:creator>Mike Kier</dc:creator>
      <dc:date>2010-04-21T18:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran TCP/IP Programming Examples?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621831#M39848</link>
      <description>&lt;!--!*#--&gt;Thanks for your answers.  But that is not my problem.  I am having trouble storing a large number in SIN$L_ADDR.  Here is a snippet of my code:&lt;BR /&gt;&lt;BR /&gt;INTEGER*8       A, B, C, D&lt;BR /&gt;RECORD/SOCKADDRIN/REMOTE_HOST&lt;BR /&gt;&lt;BR /&gt;        D = 199&lt;BR /&gt;        C = 1&lt;BR /&gt;        B = 1&lt;BR /&gt;        A = 233&lt;BR /&gt;        REMOTE_HOST.SIN$L_ADDR = (D * 256 &lt;BR /&gt;     !   * 256 * 256) +&lt;BR /&gt;     !          (C * 256 * 256) +&lt;BR /&gt;     !          (B * 256) + A&lt;BR /&gt; Integer overflow occurs when D &amp;gt; 127.  I had also tried declaring A-D as integer*4.</description>
      <pubDate>Thu, 22 Apr 2010 11:10:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621831#M39848</guid>
      <dc:creator>Darlene Riddle</dc:creator>
      <dc:date>2010-04-22T11:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran TCP/IP Programming Examples?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621832#M39849</link>
      <description>I beg to differ.  It is the problem.&lt;BR /&gt;&lt;BR /&gt;You are using math to move bytes.&lt;BR /&gt;Instead, just tell the compiler to move bytes without interpretation.&lt;BR /&gt;&lt;BR /&gt;The address is declared as an integer, which in Fortran is always signed. &lt;BR /&gt;The address is NOT an integer, it a bunch of unsigned bytes.&lt;BR /&gt;&lt;BR /&gt;The math creates a number &amp;gt; 2147483647&lt;BR /&gt;That can not be stored in 32 bit a signed integer. You could solve it by doing something hockey like doing the math into an integer*8 temp and then subtract 4*1024*1024*1024 if the value is larger than 2147483647  ( 2*1024*1024*1024-1 )&lt;BR /&gt;&lt;BR /&gt;But why bother with all that if really you just want to move bytes?&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Apr 2010 11:31:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621832#M39849</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-04-22T11:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran TCP/IP Programming Examples?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621833#M39850</link>
      <description>&lt;!--!*#--&gt;Had a problem with the web. retry&lt;BR /&gt;structure /address/&lt;BR /&gt; union&lt;BR /&gt;  map&lt;BR /&gt;   integer*4 l_address&lt;BR /&gt;  end map&lt;BR /&gt;  map&lt;BR /&gt;   byte b_addr(4)&lt;BR /&gt;  end map&lt;BR /&gt; end union&lt;BR /&gt;end structure&lt;BR /&gt;record /adress/address&lt;BR /&gt;c&lt;BR /&gt;c now fill address.b_addr(1..4)with the bytes&lt;BR /&gt;c and then sin$l_addr= address.l_address</description>
      <pubDate>Thu, 22 Apr 2010 12:30:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621833#M39850</guid>
      <dc:creator>Fekko Stubbe</dc:creator>
      <dc:date>2010-04-22T12:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran TCP/IP Programming Examples?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621834#M39851</link>
      <description>Again, stay within standard Fortran.  You are moving bits, so use the movbits intrinsic subroutine.&lt;BR /&gt;&lt;BR /&gt;Call mvbits (a, 1, 8, REMOTE_HOST.SIN$L_ADDR, 1)&lt;BR /&gt;Call mvbits (b, 1, 8, REMOTE_HOST.SIN$L_ADDR, 9)&lt;BR /&gt;Call mvbits (c, 1, 8, REMOTE_HOST.SIN$L_ADDR, 17)&lt;BR /&gt;Call mvbits (d, 1, 8, REMOTE_HOST.SIN$L_ADDR, 25)</description>
      <pubDate>Thu, 22 Apr 2010 12:51:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621834#M39851</guid>
      <dc:creator>Mike Kier</dc:creator>
      <dc:date>2010-04-22T12:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Fortran TCP/IP Programming Examples?</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621835#M39852</link>
      <description>Thanks for your answers.  I moved each byte into the integer value and it works now.</description>
      <pubDate>Thu, 22 Apr 2010 13:38:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/fortran-tcp-ip-programming-examples/m-p/4621835#M39852</guid>
      <dc:creator>Darlene Riddle</dc:creator>
      <dc:date>2010-04-22T13:38:17Z</dc:date>
    </item>
  </channel>
</rss>

