- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Fortran TCP/IP Programming Examples?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-21-2010 09:58 AM
тАО04-21-2010 09:58 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-21-2010 10:37 AM
тАО04-21-2010 10:37 AM
Re: Fortran TCP/IP Programming Examples?
Ah, I see.
You are using the example from
http://h71000.www7.hp.com/wizard/wiz_2777.html
And it is probably dying on the clumsy sign-bit protection for the byte swap
:
c = bytes(3)
d = bytes(4)
if (a .lt. 0) a = a + 256
if (b .lt. 0) b = b + 256
:
bytes is declared as INTEGER*1 but should be BYTE ?
You probably also want to fix 'htons' to use BYTE variables in an equivalence instead of signed math to switch bytes.
There are existing functions for this! (somewhere)
Sorry, no Fortran/Ucx compile environment handy to try.
Be sure to search for "unsigned" in:
http://h71000.www7.hp.com/doc/82final/6443/6443pro_009.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-21-2010 11:09 AM
тАО04-21-2010 11:09 AM
Re: Fortran TCP/IP Programming Examples?
dest = TRANSFER(source, mold)
so in your case it would be
a=transfer(bytes(3), a)
b=transfer(bytes(4), a)
etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2010 04:10 AM
тАО04-22-2010 04:10 AM
Re: Fortran TCP/IP Programming Examples?
INTEGER*8 A, B, C, D
RECORD/SOCKADDRIN/REMOTE_HOST
D = 199
C = 1
B = 1
A = 233
REMOTE_HOST.SIN$L_ADDR = (D * 256
! * 256 * 256) +
! (C * 256 * 256) +
! (B * 256) + A
Integer overflow occurs when D > 127. I had also tried declaring A-D as integer*4.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2010 04:31 AM
тАО04-22-2010 04:31 AM
SolutionYou are using math to move bytes.
Instead, just tell the compiler to move bytes without interpretation.
The address is declared as an integer, which in Fortran is always signed.
The address is NOT an integer, it a bunch of unsigned bytes.
The math creates a number > 2147483647
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 )
But why bother with all that if really you just want to move bytes?
fwiw,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2010 05:30 AM
тАО04-22-2010 05:30 AM
Re: Fortran TCP/IP Programming Examples?
structure /address/
union
map
integer*4 l_address
end map
map
byte b_addr(4)
end map
end union
end structure
record /adress/address
c
c now fill address.b_addr(1..4)with the bytes
c and then sin$l_addr= address.l_address
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2010 05:51 AM
тАО04-22-2010 05:51 AM
Re: Fortran TCP/IP Programming Examples?
Call mvbits (a, 1, 8, REMOTE_HOST.SIN$L_ADDR, 1)
Call mvbits (b, 1, 8, REMOTE_HOST.SIN$L_ADDR, 9)
Call mvbits (c, 1, 8, REMOTE_HOST.SIN$L_ADDR, 17)
Call mvbits (d, 1, 8, REMOTE_HOST.SIN$L_ADDR, 25)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2010 06:38 AM
тАО04-22-2010 06:38 AM