aboutsummaryrefslogtreecommitdiff
path: root/test_ssl.f90
blob: 04386d4ea2e75eb331373826d5f39c40a9ad7f7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
program test_ssl
use jessl
use network
use wsa_network, only: windows_network_startup => startup
implicit none

    type(sockaddr_in), target::sa
    integer::s
    
    type(simple_hostent)::hent
    
    call windows_network_startup()
    
    hent = gethostbyname("google.com")
    if(allocated(hent%h_name)) then
        Print *, "host: ", hent%h_name
        Print *, "addr: ", hent%h_addr4
    else
        Print *, "Failure"
        stop
    end if
    
    sa%sin_family = AF_INET
    sa%sin_addr%s_addr = hent%h_addr4 !inet_addr("192.168.2.90")
    sa%sin_port = htons(80)
    
    s = socket(AF_INET, SOCK_STREAM, 0);
    if(.not. connect(s, sa)) then
        Print *, "Connection failed", IERRNO()
        stop
    end if
    
    Print *, "socket opened!"
    

end program test_ssl