aboutsummaryrefslogtreecommitdiff
path: root/test_ssl.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-04-29 17:39:05 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-04-29 17:39:05 -0400
commit537ff39898992c3915bcf01e3840becc6750520f (patch)
tree0e0883ac2c10c88c7c79d4149a2db474c4a7daab /test_ssl.f90
parentdfd21b695107fc01941e3218b60d360ee38fb150 (diff)
downloadLR-87-537ff39898992c3915bcf01e3840becc6750520f.zip
LR-87-537ff39898992c3915bcf01e3840becc6750520f.tar.gz
Added some very low-level network code
Diffstat (limited to 'test_ssl.f90')
-rw-r--r--test_ssl.f9033
1 files changed, 33 insertions, 0 deletions
diff --git a/test_ssl.f90 b/test_ssl.f90
new file mode 100644
index 0000000..0e169c1
--- /dev/null
+++ b/test_ssl.f90
@@ -0,0 +1,33 @@
+program test_ssl
+use jessl
+use network
+implicit none
+
+ type(sockaddr_in), target::sa
+ integer::s
+
+ type(simple_hostent)::hent
+
+ 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 \ No newline at end of file