|
|
||
==== TCPSocket ==== インターネットドメインのストリーム型ソケットのクラス。通常の IOクラスのサブクラスと同 様の入出力ができます。このクラスによってソケットを用いたクラ イアントを簡単に記述できるようになります。ユーザの入力をその ままサーバに転送するプログラムは以下のようになります。 require "socket" port = if ARGV.size > 0 then ARGV.shift else 4444 end print port, "\n" s = TCPSocket.open("localhost", port) while gets s.write($_) print(s.gets) end s.close ---- Singleton methods ---- new open ---- Instance methods ---- ---- Singleton methods (inherited) ---- APPEND BINARY CREAT EXCL FNM_CASEFOLD FNM_DOTMATCH FNM_NOESCAPE FNM_PATHNAME FNM_PERIOD LOCK_EX LOCK_NB LOCK_SH LOCK_UN NOCTTY NONBLOCK RDONLY RDWR SEEK_CUR SEEK_END SEEK_SET SYNC TRUNC WRONLY do_not_reverse_lookup do_not_reverse_lookup= for_fd foreach getaddress pipe popen read readlines select sysopen ---- Instance methods (inherited) ---- << == === =~ __id__ __send__ _dump _load addr all? any? binmode class clone close close_read close_write closed? collect detect display dup each each_byte each_line each_with_index entries eof eof? eql? equal? extend fcntl fileno find find_all flush freeze frozen? fsync getc getpeername gets getsockname getsockopt grep hash id include? initialize initialize_copy inject inspect instance_eval instance_of? instance_variable_get instance_variable_set instance_variables ioctl is_a? isatty kind_of? lineno lineno= map marshal_dump marshal_load max member? method method_missing methods min nil? object_id partition peeraddr pid pos pos= pretty_print pretty_print_cycle pretty_print_instance_variables print printf private_methods protected_methods public_methods putc puts read readchar readline readlines recv recvfrom reject remove_instance_variable reopen respond_to? rewind seek select send setsockopt shutdown singleton_method_added singleton_method_removed singleton_method_undefined singleton_methods sort sort_by stat sync sync= sysread sysseek syswrite taint tainted? tell to_a to_ary to_hash to_i to_int to_io to_s to_str tty? type ungetc untaint write zip