- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have question(s) on creating/configuring sockets under Windows 7 Professional.
System Configuration:
- Windows 7 Professional SP1 [ 32-bit OS ]
- Intel Composer XE 2013 SP1 Update 3 for Windows
- Microsoft Visual Studio Ultimate 2013 Update 3
- Microsoft Windows SDK for Windows 7 (7.1)
Question #1:
-----------------
I would like to create a socket (UDP) under Windows 7 Professional.
sockfd = WSASocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP, 0, 0, 0)
or
consock = socket(AF_INET, SOCK_DRAM, IPPROTO_UDP)
Upon creation, I would like to poll the newly created socket:
status = WSAIoctl(sockfd,SIO_GET_INTERFACE_LIST,0,0,ifconf,sizeof(ifconf),BytesReturned,0,0)
or
{ Use the GETADDRINFO function for response information about the host }
The socket information I would like to extract is as follows:
- The network interface UP or DOWN.
- Broadcast feature supported.
- Multicast feature supported.
- Loopback Interface.
- Point-to-Point Interface.
I have included Winsock2 API by including the Winsock 2 header file.
- USE WS2_32
If the Winsock2 API does provide access to the WSASocket | WSAIoctl functions from Fortran:
- How would I get access to the INTERFACE_INFO structure used in conjunction with the SIO_GET_INTERFACE_LIST ioctl command
used to obtain information about an interface IP address?
Question #2:
-----------
The Intel Fortran Compiler states ... This name does not have a type, and must have an explicit type. [SIO_GET_INTERFACE_LIST]
- Where would I find the SIO_GET_INTERFACE_LIST ioctl code defined?
The MSDN website states "the INTERFACE_INFO structure is defined in the Ws2ipdef.h header file which is automatically included
in the Ws2tcpip.h header file. The Ws2ipdef.h header files should never be used directly."
Since Ws2ipdef.h is a C/C++ header file, I need access to the interface flag parameters from Fortran.
Therefore, I have included the following snippet in the socket program:
INTEGER(LONG) :: IFF_UP
INTEGER(LONG) :: IFF_BROADCAST
INTEGER(LONG) :: IFF_LOOPBACK
INTEGER(LONG) :: IFF_POINTTOPOINT
c
PARAMETER(IFF_UP = X'00000001') ! Interface is up
PARAMETER(IFF_BROADCAST = X'00000002') ! Broadcast address valid
PARAMETER(IFF_LOOPBACK = X'00000008') ! Is a loopback net
PARAMETER(IFF_POINTTOPOINT = X'00000010') ! Interface is point-to-point link
Do I need to define the socket snippet above in my program, or am I missing something?
I am attempting to utilize the Winsock2 API and implement socket(s) in the Fortran world without having to write the socket program
in C .
Appreciate the help in advance.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many questions and I am not familiar with the API's you discuss. Have you looked in ws2_32.f90 and ifwinty.f90? Some the the structures are defined e.g TYPE T_struct_sockaddr, andy missing ones you will need to define yourself I'm afraid .
integer(LONG), PARAMETER :: IFF_UP = int(z'00000001') ! Interface is up
Is more compact/readable and is standard Fortran 2003 i.e. it uses no language extensions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page