changeset 2:f3eb367c309f

update server
author e165727 <e165727@ie.u-ryukyu.ac.jp>
date Thu, 13 Feb 2020 16:25:31 +0900
parents e23d55b94840
children d7762f4e8bfa
files eg/fileSend.sh eg/startup.sh lib/.DS_Store lib/Abyss/Server.pm6 other/client.p6 other/client.pl other/loop.p6
diffstat 7 files changed, 32 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eg/fileSend.sh	Thu Feb 13 16:25:31 2020 +0900
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+#for i in `seq 1 10`; do
+/Users/Koo/College/lab/Perl6/rakudo/perl6-m -I/Users/Koo/College/lab/Perl6/rakudo/src/core.c -I/Users/Koo/College/lab/Perl6/rakudo/core.d -I/Users/Koo/College/lab/Perl6/rakudo/lib -Ilib other/client.p6
+#done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eg/startup.sh	Thu Feb 13 16:25:31 2020 +0900
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/Users/Koo/College/lab/Perl6/rakudo/perl6-m -I/Users/Koo/College/lab/Perl6/rakudo/src/core.c -I/Users/Koo/College/lab/Perl6/rakudo/core.d -I/Users/Koo/College/lab/Perl6/rakudo/lib -Ilib other/startup.p6
Binary file lib/.DS_Store has changed
--- a/lib/Abyss/Server.pm6	Wed Feb 05 23:45:09 2020 +0900
+++ b/lib/Abyss/Server.pm6	Thu Feb 13 16:25:31 2020 +0900
@@ -6,7 +6,7 @@
 
 sub close(int32) returns int32 is native { ... }
 sub dup(int32 $old) returns int32 is native { ... }
-sub dup2(int32 $old, int32 $new) returns int32 is native { ... }
+sub dup2(int32 $new, int32 $old) returns int32 is native { ... }
 
 method readeval 
 {
@@ -22,29 +22,33 @@
     loop 
     {
         my $conn = $listen.accept;
-        dup2($conn.native-descriptor(), 1);#stdoutをsocketに切り替え
         my $start = now;
         say "hoge";
         while my $buf = $conn.read(1024) 
         {
-            EVALFILE $buf.decode;
-            $counter++;
+            EVAL $buf.decode;
+            #$counter++;
+            last;
         }
-        my $end = now;
-        my $Time = $end - $start;
-        $sumTime = $sumTime + $Time;
-        say $Time; 
+        #my $end = now;
+        close(1);
+        dup2($conn.native-descriptor(), 1);#stdoutをsocketに切り替え
+        #my $Time = $end - $start;
+        #$sumTime = $sumTime + $Time;
+        #say $Time; 
+        say "send to Client";
         dup2($backup, 1); #file descripterを元に戻す
         close($backup); #backup消す
       
         $conn.close;
 
-        if ($counter == 10) 
-        {
-            say $sumTime;
-            last;
-        }
-    } 
+        #if ($counter == 10) 
+        #{
+        #    say $sumTime;
+        #     last;
+        #}
+    }
+    $listen.close;
 }
 
 
--- a/other/client.p6	Wed Feb 05 23:45:09 2020 +0900
+++ b/other/client.p6	Thu Feb 13 16:25:31 2020 +0900
@@ -1,5 +1,8 @@
-my $conn = IO::Socket::INET.new( :host<localhost>,
+use IO::Socket::Unix;
+
+my $conn = IO::Socket::Unix.new( :host<localhost>,
                                  :port(3333) );
-#$conn.print: 'say "helllo";';
-#say $conn.recv;
+
+$conn.print: 'say "Hello";';
+say $conn.read(1024);
 #$conn.close;
--- a/other/client.pl	Wed Feb 05 23:45:09 2020 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/usr/bin/env perl
-use strict;
-use warnings;
-
-
-for (1..100) {
-  system("perl6","other/client.p6");
- # system("perl6","other/hello_otherfile.p6");
-}
--- a/other/loop.p6	Wed Feb 05 23:45:09 2020 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#$conn.print: 'say "helllo";';
-#say $conn.recv;
-#$conn.close;
-
-for 1..100 {
-    my $conn = IO::Socket::INET.new( :host<localhost>,
-                                 :port(3333) );
-}