File: network.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (982 lines) | stat: -rw-r--r-- 34,973 bytes parent folder | download
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.25 $ -->
 <reference id="ref.network">
  <title>ネットワーク関数(network)</title>
  <titleabbrev>ネットワーク</titleabbrev>

  <refentry id="function.checkdnsrr">
   <refnamediv>
    <refname>checkdnsrr</refname>
    <refpurpose>
     指定したインターネットホスト名もしくはIPアドレスに対応するDNSレコー
     ドを検索する
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>checkdnsrr</methodname>
      <methodparam><type>string</type><parameter>host</parameter></methodparam>
      <methodparam><type>string</type><parameter>
	<replaceable><optional>type</optional></replaceable>
       </parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <parameter>host</parameter>に対応する<parameter>type</parameter>
     型のレコードをDNSから探します。レコードが見つかった場合に&true;、
     何も見つからないかエラーが発生した場合に&false;を返します。
    </simpara>
    <simpara>
     <parameter>type</parameter>は、A,MX,NS,SOA,PTR,CNAME,ANYのどれか
     一つです。デフォルトはMXです。
    </simpara>
    <simpara>
     <parameter>host</parameter>は、4つのドットを用いた表記の
     IPアドレスもしくはホスト名です。
    </simpara>
    <simpara>
     <function>getmxrr</function>,
     <function>gethostbyaddr</function>, 
     <function>gethostbyname</function>, 
     <function>gethostbynamel</function>および
     named(8)マニュアルページも参考にしてください。
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.closelog">
   <refnamediv>
    <refname>closelog</refname>
    <refpurpose>システムログへの接続を閉じる</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>closelog</methodname>
      <void/>
     </methodsynopsis>
    <para>
     <function>closelog</function>はシステムログへの書きこみに使用
     されているデスクプリタを閉じます。<function>closelog</function>の
     使用はオプションです。
    </para>
    <para>
     <function>define_syslog_variables</function>,
     <function>syslog</function>,
     <function>openlog</function>も参照下さい。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.debugger-off">
   <refnamediv>
    <refname>debugger_off</refname>
    <refpurpose>PHPの内部デバッガを無効にする</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>debugger_off</methodname>
      <void/>
     </methodsynopsis>
    <para>
     PHPの内部デバッガを無効にします。デバッガはまだ開発中です。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.debugger-on">
   <refnamediv>
    <refname>debugger_on</refname>
    <refpurpose>PHPの内部デバッガを有効にする</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>debugger_on</methodname>
      <methodparam><type>string</type><parameter>address</parameter></methodparam>
     </methodsynopsis>
    <para>
     PHPの内部デバッガを有効にし、<parameter>address</parameter>に
     接続します。デバッガはまだ開発中です。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.define-syslog-variables">
   <refnamediv>
    <refname>define_syslog_variables</refname>
    <refpurpose>syslogに関係する全ての定数を初期化する</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>void</type><methodname>define_syslog_varaibles</methodname>
      <void/>
     </methodsynopsis>
    <para>
     syslog関数で使用される全ての定数を初期化します。
    </para>
    <para>
     <function>openlog</function>,
     <function>syslog</function>,
     <function>closelog</function>も参照下さい。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fsockopen">
   <refnamediv>
    <refname>fsockopen</refname>
    <refpurpose>
     インターネットもしくはUNIXドメインのソケット接続をオープンする
    </refpurpose> 
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>fsockopen</methodname>
      <methodparam><type>string</type><parameter>
	<replaceable><optional>udp://</optional></replaceable>
	 hostname</parameter></methodparam>
      <methodparam><type>int</type><parameter>port</parameter></methodparam>
      <methodparam><type>int</type><parameter>
	<replaceable><optional>errno</optional></replaceable>
       </parameter></methodparam>
      <methodparam><type>string</type><parameter>
	<replaceable><optional>errstr</optional></replaceable>
       </parameter></methodparam>
      <methodparam><type>double</type><parameter>
	<replaceable><optional>timeout</optional></replaceable>
       </parameter></methodparam>
     </methodsynopsis>
    <para>
     Internetドメイン(AF_INET)または Unixドメイン(AF_UNIX、TCPまたは
     UDPを使用)にてストリーム接続を初期化します。Internetドメインの場合、
     <parameter>hostname</parameter>のポート<parameter>port</parameter>
     へのTCPソケット接続がオープンされます。
     UDP接続を行う際には、<parameter>udp://hostname</parameter>のよう
     に明示的にプロトコルを指定する必要があります。Unixドメインの場合、
     <parameter>hostname</parameter>はソケットへのパスとして使用され、
     <parameter>port</parameter> はこの場合0とする必要があります。
     オプションの<parameter>timeout</parameter>により接続システムコール
     がタイムアウトするまでの秒数を指定することが可能です。
    </para>
    <para>
     <function>fsockopen</function>は、ファイルポインタを返します。
     このファイルポインタは、
     (<function>fgets</function>,<function>fgetss</function>,
     <function>fputs</function>, <function>fclose</function>,
     <function>feof</function>のような)
     他のファイル関数で使用可能です。
    </para>
    <para>
     コールに失敗した場合には&false;が返され、オプションの引数
     <parameter>errno</parameter>および<parameter>errstr</parameter>
     が指定されている場合、システムコール<literal>connect()</literal>
     で生じた実際のシステムレベルエラーを示すように設定されます。
     errnoは0なのに関数が&false;を返す場合、<literal>connect()</literal>
     をコールする前にエラーを発生したことを示します。
     この場合、おそらくはソケットの初期化に原因があります。引数errno
     およびerrstrは参照渡しでなければならないことに注意してください。
    </para>
    <para>
     環境によってはUNIXドメインまたはオプションの接続タイムアウトは利用
     できません。
    </para>
    <para>
     ソケットはデフォルトでブロックモードで開かれます。
     <function>socket_set_blocking</function>を使用して、
     非ブロックモードに切換えることができます。
     <example>
      <title><function>fsockopen</function>の例</title>
      <programlisting role="php">
<![CDATA[
<?php
$fp = fsockopen ("www.php.net", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)<br>\n";
} else {
    fputs ($fp, "GET / HTTP/1.0\r\nHost: www.php.net\r\n\r\n");
    while (!feof($fp)) {
        echo fgets ($fp,128);
    }
    fclose ($fp);
}
?>
]]>
      </programlisting>
     </example>
     以下の例は、自分のマシンのUDPサービス "daytime" (ポート13)から日
     付と時間を取得する方法を示すものです。
     <example>
      <title>UDP接続の使用法</title>
      <programlisting role="php">
<![CDATA[
<?php
$fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr);
if (!$fp) {
    echo "ERROR: $errno - $errstr<br>\n";
} else {
    fwrite($fp,"\n");
    echo fread($fp, 26);
    fclose($fp);
}
?>
]]>
      </programlisting>
     </example>
     <note>
      <para>
       <parameter>timeout</parameter> は PHP 3.0.9 でサポートされまし
       た。また、UDP のサポートは PHP 4で追加されました。
      </para>
     </note>
     <function>pfsockopen</function>,
     <function>socket_set_blocking</function>,
     <function>socket_set_timeout</function>, <function>fgets</function>,
     <function>fgetss</function>, <function>fputs</function>,
     <function>fclose</function>, <function>feof</function> も参照下さい。
   </para>
   </refsect1>
  </refentry>

  <refentry id="function.gethostbyaddr">
   <refnamediv>
    <refname>gethostbyaddr</refname>
    <refpurpose>
     指定したIPアドレスに対応するインターネットホスト名を取得する
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>string</type><methodname>gethostbyaddr</methodname>
      <methodparam><type>string</type><parameter>ip_address</parameter></methodparam>
     </methodsynopsis>
    <para>
     <parameter>ip_address</parameter>で指定したインターネットホストの
     ホスト名を返します。エラーが発生した場合、
     <parameter>ip_address</parameter>を返します。
    </para>
    <para>
     <function>gethostbyname</function>も参考にしてください。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gethostbyname">
   <refnamediv>
    <refname>gethostbyname</refname>
    <refpurpose>
     インターネットホスト名に対応するIPアドレスを取得する
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>string</type><methodname>gethostbyname</methodname>
      <methodparam><type>string</type><parameter>hostname</parameter></methodparam>
     </methodsynopsis>
    <para>
     <parameter>hostname</parameter>で指定したインターネットホストの
     IPアドレスを返します。
    </para>
    <para>
     <function>gethostbyaddr</function>も参考にしてください。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gethostbynamel">
   <refnamediv>
    <refname>gethostbynamel</refname>
    <refpurpose>
     指定したインターネットホスト名に対応するIPアドレスのリストを取得
     する。
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>array</type><methodname>gethostbynamel</methodname>
      <methodparam><type>string</type><parameter>hostname</parameter></methodparam>
     </methodsynopsis>
    <para>
     <parameter>hostname</parameter>で指定したインターネットホストを
     検索して得られた IPアドレスのリストを返します。
    </para>
    <para>
     <function>gethostbyname</function>,
     <function>gethostbyaddr</function>, 
     <function>checkdnsrr</function>,
     <function>getmxrr</function>および
     named(8)マニュアルページも参考にしてください。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.getmxrr">
   <refnamediv>
    <refname>getmxrr</refname>
    <refpurpose>
     指定したインターネットホスト名に対応するMXレコードを取得する
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>getmxrr</methodname>
      <methodparam><type>string</type><parameter>hostname</parameter></methodparam>
      <methodparam><type>array</type><parameter>mxhosts</parameter></methodparam>
      <methodparam><type>array</type><parameter>
	<replaceable><optional>weight</optional></replaceable>
       </parameter></methodparam>
     </methodsynopsis>
    <simpara>
     <parameter>hostname</parameter>に対応するMXレコードをDNSから探します。
     何かレコードが見つかった場合に&true;を返し、何も見つからないかエラーが
     発生した場合に&false;を返します。
    </simpara>
    <simpara>
     見つかったMXレコードのリストは、配列<parameter>mxhosts</parameter>
     に収容されます。配列<parameter>weight</parameter>が指定された場合、
     得られた重み情報が代入されます。
    </simpara>
    <simpara>
     <function>checkdnsrr</function>,
     <function>gethostbyname</function>,
     <function>gethostbynamel</function>,
     <function>gethostbyaddr</function>および
     named(8)マニュアルページも参考にしてください。
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.getprotobyname">
   <refnamediv>
    <refname>getprotobyname</refname>
    <refpurpose>
     プロトコル名のプロトコル番号を得る
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>getprotobyname</methodname>
      <methodparam><type>string</type><parameter>name</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>getprotobyname</function>は、プロトコル
     <parameter>name</parameter>のプロトコル番号を/etc/protocolsから
     取得して返します。
    </para>
    <para>
     <function>getprotobynumber</function>も参照下さい。
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.getprotobynumber">
   <refnamediv>
    <refname>getprotobynumber</refname>
    <refpurpose>プロトコル番号が指すプロトコル名を得る</refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>string</type><methodname>getprotobynumber</methodname>
      <methodparam><type>int</type><parameter>number</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>getprotobynumber</function>は、/etc/protocolsに基づき
     プロトコル番号<parameter>number</parameter>が指すプロトコル名を
     返します。
    </para>
    <para>
     <function>getprotobyname</function>も参照下さい。
    </para>
   </refsect1>
  </refentry>
   
  <refentry id="function.getservbyname">
   <refnamediv>
    <refname>getservbyname</refname>
    <refpurpose>
     インターネットサービスおよびプロトコルが関連するポート番号を得る
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>getservbyname</methodname>
      <methodparam><type>string</type><parameter>service</parameter></methodparam>
      <methodparam><type>string</type><parameter>protocol</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>getservbyname</function>は、/etc/servicesに基づき
     指定したプロトコル<parameter>protocol</parameter>に関して
     <parameter>service</parameter>に対応するインターネットポートを
     返します。
     <parameter>protocol</parameter>は、<literal>TCP</literal>または
     <literal>UDP</literal>である必要があります。
    </para>
    <para>
     <function>getservbyport</function>も参照下さい。
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.getservbyport">
   <refnamediv>
    <refname>getservbyport</refname>
    <refpurpose>
     ポートおよびプロトコルに対応するインターネットサービスを得る
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>string</type><methodname>getservbyport</methodname>
      <methodparam><type>int</type><parameter>port</parameter></methodparam>
      <methodparam><type>string</type><parameter>protocol</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>getservbyport</function>は、/etc/servicesに基づき
     指定したプロトコル<parameter>protocol</parameter>に関して
     ポート<parameter>port</parameter>に関連するインターネットサービスを
     返します。<parameter>protocol</parameter>は、<literal>TCP</literal>
     または<literal>UDP</literal>のどちらかです。
    </para>
    <para>
     <function>getservbyname</function>も参照下さい。
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.ip2long">
   <refnamediv>
    <refname>ip2long</refname>
    <refpurpose>
     (IPv4) インターネットプロトコルドット表記のアドレスを適当なアドレ
     スを有する文字列に変換する
    </refpurpose> 
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>ip2long</methodname>
      <methodparam><type>string</type><parameter>ip_address</parameter></methodparam>
     </methodsynopsis>
    <para>
     関数 <function>ip2long</function> は、インターネット標準形式(ドッ
     ト表記の文字列)表現からIPv4 インターネットネットアドレスを生成し
     ます。
     <example>
      <title><function>ip2long</function>の例</title>
      <programlisting role="php">
<![CDATA[
<?php
$ip = gethostbyname("www.php.net");
$out = "The following URLs are equivalent:<br>\n";
$out .= "http://www.php.net/, http://".$ip."/, and http://".sprintf("%u",ip2long($ip))."/<br>\n";
echo $out;
?>
]]>
      </programlisting>
     </example>
    </para>
    <para>
     2番目の例は、<function>printf</function> 関数で変換されたアドレス
     を出力する方法を示すものです。
     <example>
     <title>IPアドレスの表示</title>
     <programlisting role="php">
<![CDATA[
<?php
$ip = gethostbyname("www.php.net");
printf("%u\n", ip2long($ip));
echo $out;
?>
]]>
     </programlisting>
     </example>
    </para>
    <para>
     <function>long2ip</function>も参照下さい。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.long2ip">
   <refnamediv>
    <refname>long2ip</refname>
    <refpurpose>
     (IPv4) インターネットアドレスをインターネット標準ドット表記に変換
     します。
    </refpurpose> 
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>string</type><methodname>long2ip</methodname>
      <methodparam><type>int</type><parameter>proper_address</parameter></methodparam>
     </methodsynopsis>
    <para>
     関数<function>long2ip</function> は、適当なアドレス表現からドット
     表記(例:aaa.bbb.ccc.ddd)のインターネットアドレスを生成します。
    </para>
    <para>
     <function>ip2long</function>も参照下さい。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.openlog">
   <refnamediv>
    <refname>openlog</refname>
    <refpurpose>システムログへの接続をオープンする</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>openlog</methodname>
      <methodparam><type>string</type><parameter>ident</parameter></methodparam>
      <methodparam><type>int</type><parameter>option</parameter></methodparam>
      <methodparam><type>int</type><parameter>facility</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>openlog</function>は、プログラムによるシステムログへの
     接続をオープンします。
     文字列<parameter>ident</parameter>は、各メッセージに
     追加されます。<parameter>option</parameter>および
     <parameter>facility</parameter>の値は、以下で説明します。
     <parameter>option</parameter> 引数は、ログメッセージの生成時に使
     用されるロギング用オプションを指定するために使用されます。
     引数 <parameter>facility</parameter> には、ロギングを行う際のメッ
     セージ型を指定します。これにより、(使用するシステムのsyslogの設定
     に関して)異なった facility を有するメッセージをどの程度処理するか
     を指定することが可能になります。
     <function>openlog</function>の使用は必須ではありません。この関数
     は、必要な場合に<function>syslog</function>により自動的に呼び出さ
     れます。この場合、<parameter>ident</parameter>のデフォルト値は
     &false;となります。
    </para>
    <para>
     <table>
      <title><function>openlog</function>のオプション</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>定数</entry>
         <entry>説明</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>LOG_CONS</entry>
         <entry>
	  システムログにデータが送信される間にエラーが発生した場合、直
          接、システムコンソールに書き込まれます。
         </entry>
        </row>
        <row>
         <entry>LOG_NDELAY</entry>
         <entry>
	  直ちにログへの接続をオープンします。
         </entry>
        </row>
        <row>
         <entry>LOG_ODELAY</entry>
         <entry>
          (デフォルト) 最初のメッセージがロギングされるまで接続のオー
          プンを遅延します。
         </entry>
        </row>
        <row>
         <entry>LOG_PERROR</entry>
         <entry>標準エラー出力にもログメッセージを出力します。</entry>
        </row>
        <row>
         <entry>LOG_PID</entry>
         <entry>各メッセージにPIDをインクルードします</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
     このオプションを一つまたは複数設定することが可能です。複数のオプ
     ションを使用した場合、これらの論理和をとる必要があります。すなわ
     ち、直ちに接続をオープンし、コンソールに書き込み、各メッセージに
     PIDをインクルードするには、次のようにします。
     : <literal>LOG_CONS | LOG_NDELAY | LOG_PID</literal>
    </para>
    <para>
     <table>
      <title><function>openlog</function> の機能</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>定数</entry>
         <entry>説明</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>LOG_AUTH</entry>
         <entry>
	  定数が定義された場所で
	  セキュリティ/認証用メッセージ
	  (定数LOG_AUTHPRIVが定義されているシステムでは、代わりにそれ
	  を使用して下さい。)
         </entry>
        </row>
        <row>
         <entry>LOG_AUTHPRIV</entry>
         <entry>セキュリティ/認証 メッセージ(プライベート)</entry>
        </row>
        <row>
         <entry>LOG_CRON</entry>
         <entry>クロン デーモン(cron およびat)</entry>
        </row>
        <row>
         <entry>LOG_DAEMON</entry>
         <entry>他のシステムデーモン</entry>
        </row>
        <row>
         <entry>LOG_KERN</entry>
         <entry>カーネルメッセージ</entry>
        </row>
        <row>
         <entry>LOG_LOCAL0 ... LOG_LOCAL7</entry>
         <entry>ローカルでの使用のために確保</entry>
        </row>
        <row>
         <entry>LOG_LPR</entry>
         <entry>ラインプリンタサブシステム</entry>
        </row>
        <row>
         <entry>LOG_MAIL</entry>
         <entry>メールサブシステム</entry>
        </row>
        <row>
         <entry>LOG_NEWS</entry>
         <entry>USENET ニュース サブシステム</entry>
        </row>
        <row>
         <entry>LOG_SYSLOG</entry>
         <entry>syslogd で内部的に生成されたメッセージ</entry>
        </row>
        <row>
         <entry>LOG_USER</entry>
         <entry>一般的なユーザーレベルのメッセージ</entry>
        </row>
        <row>
         <entry>LOG_UUCP</entry>
         <entry>UUCP サブシステム</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     <function>define_syslog_variables</function>,
     <function>syslog</function>,<function>closelog</function>も
     参考にしてください。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pfsockopen">
   <refnamediv>
    <refname>pfsockopen</refname>
    <refpurpose>
     持続的なInternetまたはUnixドメインソケット接続をオープンする
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>pfsockopen</methodname>
      <methodparam><type>string</type><parameter>hostname</parameter></methodparam>
      <methodparam><type>int</type><parameter>port</parameter></methodparam>
      <methodparam><type>int</type><parameter>
	<replaceable><optional>errno</optional></replaceable>
       </parameter></methodparam>
      <methodparam><type>string</type><parameter>
	<replaceable><optional>errstr</optional></replaceable>
       </parameter></methodparam>
      <methodparam><type>int</type><parameter>
	<replaceable><optional>timeout</optional></replaceable>
       </parameter></methodparam>
     </methodsynopsis>
    <para>
     この関数は、<function>fsockopen</function> と全く同様に動作します。
     ただし、この関数による接続はリクエストが終了した後でも閉じられない
     という違いがあります。
     この関数は、<function>fsockopen</function>の持続的接続版です。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.socket-get-status">
   <refnamediv>
    <refname>socket_get_status</refname>
    <refpurpose>
     既存のソケットリソースに関する情報を返す
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>array</type><methodname>socket_get_status</methodname>
      <methodparam><type>resource</type><parameter>socket_get_status</parameter></methodparam>
     </methodsynopsis>
    <para>
     既存のソケットリソースに関する情報を返します。現在、結果の配列に
     は4つのエントリが返されます。
    </para>
    <itemizedlist>
     <listitem>
      <para>
       <parameter>timed_out</parameter> (bool) - データに関するソケッ
       トタイムアウト
      </para>
     </listitem>
     <listitem>
      <para>
       <parameter>blocked</parameter> (bool) - ソケットはブロックされる
      </para>
     </listitem>
     <listitem>
      <para>
       <parameter>eof</parameter> (bool) - EOF イベントを示す
      </para>
     </listitem>
     <listitem>
      <para>
       <parameter>unread_bytes</parameter> (int) - ソケットバッファの
       残りのバイト数
      </para>
     </listitem>
    </itemizedlist>
    <para>
     <function>accept_connect</function>,
     <function>bind</function>,
     <function>connect</function>,
     <function>listen</function>, 
     <function>strerror</function>も参照下さい。
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.socket-set-blocking">
   <refnamediv>
    <refname>socket_set_blocking</refname>
    <refpurpose>ソケットにおけるブロック非ブロックモードの設定</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>socket_set_blocking</methodname>
      <methodparam><type>int</type><parameter>socket descriptor</parameter></methodparam>
      <methodparam><type>int</type><parameter>mode</parameter></methodparam>
     </methodsynopsis>
    <para>
     <parameter>mode</parameter>が&false;の場合、指定したソケット記述子
     は非ブロックモードに切換ります。&true;の場合には、ブロックモードに
     切換ります。これは、ソケットから読み込みを行う
     <function>fgets</function>等のコールに影響します。
     非ブロックモードでは<function>fgets</function>は常にただちに値を
     返しますが、ブロックモードではデータがソケット上で取得可能に
     なるまで待ちつづけます。
    </para>
    <para>
     この関数は、以前は<function>set_socket_blocking</function>として
     コールされていましたが、この使用法は推奨されていません。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.socket-set-timeout">
   <refnamediv>
    <refname>socket_set_timeout</refname>
    <refpurpose>ソケットのタイムアウト時間を設定する</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>bool</type><methodname>socket_set_timeout</methodname>
      <methodparam><type>int</type><parameter>socket descriptor</parameter></methodparam>
      <methodparam><type>int</type><parameter>seconds</parameter></methodparam>
      <methodparam><type>int</type><parameter>microseconds</parameter></methodparam>
     </methodsynopsis>
    <para>
     <parameter>seconds</parameter>および
     <parameter>microseconds</parameter>の和として表した
     タイムアウトの値を<parameter>socket descriptor</parameter>に設定
     します。
     <example>
     <title><function>socket_set_timeout</function>の例</title>
      <programlisting role="php">
<![CDATA[
<?php
$fp = fsockopen("www.php.net", 80);
if(!$fp) {
    echo "Unable to open\n";
} else {
    fputs($fp,"GET / HTTP/1.0\n\n");
    $start = time();
    socket_set_timeout($fp, 2);
    $res = fread($fp, 2000);
    var_dump(socket_get_status($fp));
    fclose($fp);
    print $res;
}
?>
]]>
      </programlisting>
     </example>
    </para>
    <para>
     この関数は、以前は <function>set_socket_timeout</function>として
     コールされていましたが、この関数を使用することは推奨されません。
    </para>
    <para>
     <function>fsockopen</function>および<function>fopen</function>も
     参照下さい。
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.syslog">
   <refnamediv>
    <refname>syslog</refname>
    <refpurpose>システムログのメッセージを生成する</refpurpose>     
   </refnamediv>
   <refsect1>
    <title>説明</title>
     <methodsynopsis>
      <type>int</type><methodname>syslog</methodname>
      <methodparam><type>int</type><parameter>priority</parameter></methodparam>
      <methodparam><type>string</type><parameter>message</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>syslog</function>はシステムログが出力するログメッセージを
     生成します。<parameter>priority</parameter>は、容易さ(facility)と
     レベル(level)の組み合わせで、その値については、次節で説明します。
     残りの引数は送信するメッセージです。ただし、文字<literal>%m</literal>
     は、<errortype>errno</errortype>の値に
     対応するエラーメッセージ文字列(strerror)に置換されます。
    </para>
    <para>
     <table>
      <title><function>syslog</function>の優先順位 (降順)</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>定数</entry>
         <entry>説明</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>LOG_EMERG</entry>
         <entry>システムは使用不可</entry>
        </row>
        <row>
         <entry>LOG_ALERT</entry>
         <entry>アクションを直ちにおこす必要がある</entry>
        </row>
        <row>
         <entry>LOG_CRIT</entry>
         <entry>致命的な条件</entry>
        </row>
        <row>
         <entry>LOG_ERR</entry>
         <entry>エラーを発生する条件</entry>
        </row>
        <row>
         <entry>LOG_WARNING</entry>
         <entry>警告を発生する条件</entry>
        </row>
        <row>
         <entry>LOG_NOTICE</entry>
         <entry>通常の動作だが、特徴的な条件</entry>
        </row>
        <row>
         <entry>LOG_INFO</entry>
         <entry>情報を与えるメッセージ</entry>
        </row>
        <row>
         <entry>LOG_DEBUG</entry>
         <entry>デバッグ用のメッセージ</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     <example>
      <title><function>syslog</function>の使用例</title>
      <programlisting role="php">
<![CDATA[
<?php
define_syslog_variables();
// syslogをオープンし、プロセスIDをインクルードし、標準エラー出力にも
// ログを出力します。そして、ユーザ定義のログ記録機構を使用します。
openlog("myScripLog", LOG_PID | LOG_PERROR, LOG_LOCAL0);

// 何らかのコード

if (authorized_client()) {
    // 何かをする
} else {
    // クライアントは未認証!
    // ログを記録する
    $access = date("Y/m/d H:i:s");
    syslog(LOG_WARNING,"Unauthorized client: $access $REMOTE_ADDR ($HTTP_USER_AGENT)");
}

closelog();
?>
]]>
      </programlisting>
     </example>
     ユーザ定義のログハンドラの設定に関する情報については、UNIXマニュ
     アルの<citerefentry><refentrytitle>syslog.conf</refentrytitle>
     <manvolnum>5</manvolnum></citerefentry>を参照下さい。 
     syslog の facility と option に関するより詳細な情報は、
     UNIXマシンの<citerefentry><refentrytitle>syslog</refentrytitle>
     <manvolnum>3</manvolnum></citerefentry>にあります。
    </para>
    <para>
     Windows NTでは、syslog サービスはイベントログを使用してエミュレー
     トされます。
    </para>
    <para>
     <function>define_syslog_variables</function>,
     <function>openlog</function>,
     <function>closelog</function>も参照下さい。
    </para>
   </refsect1>
  </refentry>

 </reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->