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 (990 lines) | stat: -rw-r--r-- 33,545 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
983
984
985
986
987
988
989
990
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- EN-Revision: 1.58 Maintainer: cortesi  Status: ready -->
<!-- CREDITS: valente -->
 <reference id="ref.network">
  <title>Funzioni di rete</title>
  <titleabbrev>Rete</titleabbrev>

  <refentry id="function.checkdnsrr">
   <refnamediv>
    <refname>checkdnsrr</refname>
    <refpurpose>
     Controlla i record DNS relativi ad un host Internet o
     indirizzo IP 
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>checkdnsrr</methodname>
      <methodparam><type>string</type><parameter>host</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>type</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     Cerca i record DNS del tipo <parameter>type</parameter>
     corrispondenti a <parameter>host</parameter>. Restituisce vero se
     dei records sono trovati; falso se nessun record viene trovato
     o in caso di errore.
    </simpara>
    <simpara>
     <parameter>type</parameter> pu essere uno dei seguenti: A, MX, 
     NS, SOA, PTR, CNAME, oppure ANY.  Il default  MX.
    </simpara>
    <simpara>
     <parameter>Host</parameter> pu essere sia l'indirizzo IP in
     notazione decimale o il nome dell'host.
    </simpara>
    &note.no-windows;
    <simpara>
     Vedere anche <function>getmxrr</function>,
     <function>gethostbyaddr</function>,
     <function>gethostbyname</function>,
     <function>gethostbynamel</function> e la man page 
     named(8).
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.closelog">
   <refnamediv>
    <refname>closelog</refname>
    <refpurpose>Chiude la connessione al logger di sistema</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>closelog</methodname>
      <void/>
     </methodsynopsis>
    <para>
     <function>closelog</function> chiude il descrittore usato
     per scrivere al logger di sistema.  L'uso di
     <function>closelog</function>  facoltativo.
    </para>
    <para>
     Vedere anche <function>define_syslog_variables</function>,
     <function>syslog</function> e
     <function>openlog</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.debugger-off">
   <refnamediv>
    <refname>debugger_off</refname>
    <refpurpose>Disattiva il debugger interno PHP</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>debugger_off</methodname>
      <void/>
     </methodsynopsis>
    <para>
     Disattiva il debugger interno PHP.  Il debugger  ancora in fase di
     sviluppo.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.debugger-on">
   <refnamediv>
    <refname>debugger_on</refname>
    <refpurpose>Attiva il debugger interno PHP</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>debugger_on</methodname>
      <methodparam><type>string</type><parameter>indirizzo</parameter></methodparam>
     </methodsynopsis>
    <para>
     Attiva il debugger interno PHP, connettendolo ad 
     <parameter>indirizzo</parameter>. Il debugger  in fase di 
     sviluppo.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.define-syslog-variables">
   <refnamediv>
    <refname>define_syslog_variables</refname>
    <refpurpose>Inizializza tutte le costanti collegate al syslog</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>void</type><methodname>define_syslog_variables</methodname>
      <void/>
     </methodsynopsis>
    <para>
     Inizializza tutte le costanti usate nelle funzioni del syslog.
    </para>
    <para>
     Vedere anche <function>openlog</function>,
     <function>syslog</function> e
     <function>closelog</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.fsockopen">
   <refnamediv>
    <refname>fsockopen</refname>
    <refpurpose>
     Apre una connessione a un socket appartenente a un dominio Internet o Unix
    </refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>fsockopen</methodname>
      <methodparam><type>string</type><parameter>hostname</parameter></methodparam>
      <methodparam><type>int</type><parameter>porta</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>errno</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>errstr</parameter></methodparam>
      <methodparam choice="opt"><type>float</type><parameter>timeout</parameter></methodparam>
     </methodsynopsis>
    <para>
     Inizializza una connessione nel dominio Internet (AF_INET, usando TCP
     o UDP) o Unix (AF_UNIX). Per il dominio Internet, apre
     una connessione a un socket TCP verso l'
     <parameter>hostname</parameter> sulla porta
     <parameter>port</parameter>.  <parameter>hostname</parameter> pu essere
     in questo caso, sia un fully qualified domain name o un indirizzo IP.
     Per le connessioni UDP,  necessario specificare esplicitamente il 
     protocollo, usando: '<literal>udp://</literal>' come prefisso di 
     <parameter>hostname</parameter>. Per il dominio Unix, 
     <parameter>hostname</parameter> viene utilizzato come percorso verso il 
     socket, in questo caso, <parameter>porta</parameter> deve essere impostato
     a 0. Il parametro opzionale <parameter>timeout</parameter> pu essere 
     usato per impostare un timeout in secondi per la chiamata di sistema connect.
    </para>
    <para>
     <function>fsockopen</function> restituisce un puntatore a file che pu
     essere usato nelle altre funzioni orientate ai file (come
     <function>fgets</function>, <function>fgetss</function>,
     <function>fputs</function>, <function>fclose</function> e
     <function>feof</function>).
    </para>
    <para>
     Se la chiamata non ha successo, viene restituito &false; e se gli argomenti opzionali
     <parameter>errno</parameter> e <parameter>errstr</parameter>
     sono presenti, vengono impostati a indicare l'errore
     a livello di sistema che  avvenuto nella chiamata alla funzione
     <literal>connect()</literal> del sistema operativo. Se il valore di 
     <parameter>errno</parameter> restituito  <literal>0</literal> e
     la funzione restituisce &false;,  un'indicazione che l'errore
      avvenuto prima della chiamata di <literal>connect()</literal>. Questo 
     molto probabilmente legato ad un problema di inizializzazione del socket. Si noti che
     gli argomenti <parameter>errno</parameter> e
     <parameter>errstr</parameter> verranno sempre passati by
     reference.
    </para>
    <para>
     A seconda dell'ambiente operativo, il dominio Unix o l'opzionale
     timeout della connect potrebbero non essere disponibili.
    </para>
    <para>
     Il socket viene aperto di default in modo blocking. Si pu passare
     al modo non-blocking usando
     <function>socket_set_blocking</function>.
     <example>
      <title>Esempio di <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>
     L'esempio seguente mostra come ottenere data e ora
     tramite il servizio UDP "daytime" (porta 13) della vostra stessa macchina.
     <example>
     <title>Uso di connessione UDP</title>
     <programlisting role="php">
<![CDATA[
<?php
$fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr);
if (!$fp) {
    echo "ERRORE: $errno - $errstr<br>\n";
} else {
    fwrite($fp,"\n");
    echo fread($fp, 26);
    fclose($fp);
}
?>
]]>
     </programlisting>
     </example>
     <note>
      <para>Il parametro timeout  stato introdotto nel PHP 3.0.9 e
      il supporto UDP  stato aggiunto nel PHP 4.
      </para>
     </note>
     Vedere anche <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> e
     l'<link linkend="ref.curl">estensione Curl</link>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.gethostbyaddr">
   <refnamediv>
    <refname>gethostbyaddr</refname>
    <refpurpose>
     Ottiene l'host Internet corrispondente a un dato indirizzo IP
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>string</type><methodname>gethostbyaddr</methodname>
      <methodparam><type>string</type><parameter>indirizzo_ip</parameter></methodparam>
     </methodsynopsis>
    <para>
     Restituisce l'hostname dell'host Internet specificato da
     <parameter>indirizzo_ip</parameter>. Se occorre un errore, restituisce
     <parameter>indirizzo_ip</parameter>.
    </para>
    <para>
     Vedere anche <function>gethostbyname</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gethostbyname">
   <refnamediv>
    <refname>gethostbyname</refname>
    <refpurpose>
     Ottiene l'indirizzo IP corrispondente a un dato hostname Internet
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>string</type><methodname>gethostbyname</methodname>
      <methodparam><type>string</type><parameter>hostname</parameter></methodparam>
     </methodsynopsis>
    <para>
     Restituisce l'indirizzo IP dell'host Internet specificato da
     <parameter>hostname</parameter>.
    </para> 
    <para>
     Vedere anche <function>gethostbyaddr</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gethostbynamel">
   <refnamediv>
    <refname>gethostbynamel</refname>
    <refpurpose>
     Ottiene la lista degli indirizzi IP corrispondenti a un dato hostname 
     Internet
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>array</type><methodname>gethostbynamel</methodname>
      <methodparam><type>string</type><parameter>hostname</parameter></methodparam>
     </methodsynopsis>
    <para>
     Restituisce una lista di indirizzi IP che risolvono nei confronti dell'host Internet
     specificato da <parameter>hostname</parameter>.
    </para>
    <para>
     Vedere anche <function>gethostbyname</function>,
     <function>gethostbyaddr</function>,
     <function>checkdnsrr</function>, <function>getmxrr</function>
     e la pagina man <literal>named(8)</literal>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.getmxrr">
   <refnamediv>
    <refname>getmxrr</refname>
    <refpurpose>
     Ottiene i record MX corrispondenti a un dato nome di host Internet
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</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 choice="opt"><type>array</type><parameter>weight</parameter></methodparam>
     </methodsynopsis>
    <simpara>
     Cerca nel DNS i record MX corrispondenti a
     <parameter>hostname</parameter>. Restituisce &true; se ne vengono 
     trovati. Restituisce &false; se non ne vengono trovati o se avviene un
     errore.
    </simpara>
    <simpara>
     La lista di record MX trovati viene messa nell'array
     <parameter>mxhosts</parameter>. Se viene indicato l'array
     <parameter>weight</parameter>, esso viene riempito con
     le informazioni ottenute sui vari pesi.
    </simpara>
    <simpara>
     Vedere anche <function>checkdnsrr</function>,
     <function>gethostbyname</function>,
     <function>gethostbynamel</function>,
     <function>gethostbyaddr</function>e la pagina man
     <literal>named(8)</literal>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.getprotobyname">
   <refnamediv>
    <refname>getprotobyname</refname>
    <refpurpose>
     Ottiene il numero del protocollo associato al nome del protocollo
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>getprotobyname</methodname>
      <methodparam><type>string</type><parameter>nome</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>getprotobyname</function> restituisce il numero del protocollo 
     associato al protocollo <parameter>nome</parameter> come in
     <filename>/etc/protocols</filename>.
    </para>
    <para>
     Vedere anche: <function>getprotobynumber</function>.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.getprotobynumber">
   <refnamediv>
    <refname>getprotobynumber</refname>
    <refpurpose>
     Ottiene il nome del protocollo associato al numero del protocollo
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>string</type><methodname>getprotobynumber</methodname>
      <methodparam><type>int</type><parameter>numero</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>getprotobynumber</function> restituisce il nome del protocollo 
     associato al protocollo <parameter>numero</parameter> come in
     <filename>/etc/protocols</filename>.
    </para>
    <para>
     Vedere anche: <function>getprotobyname</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.getservbyname">
   <refnamediv>
    <refname>getservbyname</refname>
    <refpurpose>
     Ottiene il numero di porta associato ad un servizio Internet e ad un protocollo
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>getservbyname</methodname>
      <methodparam><type>string</type><parameter>servizio</parameter></methodparam>
      <methodparam><type>string</type><parameter>protocollo</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>getservbyname</function> restituisce la porta Internet
     corrispondente a <parameter>servizio</parameter> per il
     <parameter>protocollo</parameter> specificato come in
     <filename>/etc/services</filename>.
     <parameter>protocollo</parameter> pu essere sia <literal>TCP</literal>
     che <literal>UDP</literal>.
    </para>
    <para>
     Vedere anche: <function>getservbyport</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.getservbyport">
   <refnamediv>
    <refname>getservbyport</refname>
    <refpurpose>
     Ottiene il servizio Internet corrispondente ad una porta e ad un protocollo
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>string</type><methodname>getservbyport</methodname>
      <methodparam><type>int</type><parameter>porta</parameter></methodparam>
      <methodparam><type>string</type><parameter>protocollo</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>getservbyport</function> restituisce il servizio Internet
     associato a <parameter>porta</parameter> relativamente al
     <parameter>protocollo</parameter> specificato come in <filename>/etc/services</filename>.
     <parameter>protocollo</parameter> pu essere sia <literal>TCP</literal>
     che <literal>UDP</literal>.
    </para>
    <para>
     Vedere anche: <function>getservbyname</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ip2long">
   <refnamediv>
    <refname>ip2long</refname>
    <refpurpose>
      Converts a string containing an (IPv4) Internet Protocol dotted address
      into a proper address.
      Converte una stringa contenente un indirizzo di rete del Protocollo Internet (IPv4)
      in un indirizzo espresso come tipo di dato int.
    </refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>ip2long</methodname>
      <methodparam><type>string</type><parameter>indirizzo_ip</parameter></methodparam>
     </methodsynopsis>
    <para>
     La funzione <function>ip2long</function> genera un indirizzo di rete Internet IPv4
     a partire dalla rappresentazione in formato standard 
     (stringa separata da punti).
     <example>
      <title>Esempio di <function>ip2long</function></title>
      <programlisting role="php">
<![CDATA[
<?php
$ip = gethostbyname("www.php.net");
$out = "I seguenti URL sono equivalenti:<br>\n";
$out .= "http://www.php.net/, http://".$ip."/, e http://".sprintf("%u",ip2long($ip))."/<br>\n";
echo $out;
?>
]]>
      </programlisting>
     </example>
     <note>
      <para>
       Poich il tipo di dato integer in PHP  signed e molti indirizzi IP risulterebbero essere 
       interi negativi,  necessario usare il formattatore "%u" della funzione
       <function>sprintf</function> e <function>printf</function> per ottenere
       la rappresentazione in stringa dell'indirizzo IP in modo nsigned.
      </para>
     </note>
     Questo secondo esempio mostra come stampare un indirizzo convertito, usando la
     funzione <function>printf</function>:
     <example>
      <title>Visualizzazione di un indirizzo IP</title>
      <programlisting role="php">
<![CDATA[
<?php
$ip = gethostbyname("www.php.net");
printf("%u\n", ip2long($ip));
echo $out;
?>
]]>
      </programlisting>
     </example>
    </para>
    <para>
     Vedere anche: <function>long2ip</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.long2ip">
   <refnamediv>
    <refname>long2ip</refname>
    <refpurpose>
      Converte un indirizzo di rete del Protocollo Internet (IPv4) in una stringa contenente
      un indirizzo espresso secondo la notazione standard di Internet.
    </refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>string</type><methodname>long2ip</methodname>
      <methodparam><type>int</type><parameter>proper_address</parameter></methodparam>
     </methodsynopsis>
    <para>
     La funzione <function>long2ip</function> genera un indirizzo Internet
     in formato separato da punti (es.: aaa.bbb.ccc.ddd) a partire dalla rappresentazione 
     propria.
    </para>
    <para>
     Vedere anche: <function>ip2long</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.openlog">
   <refnamediv>
    <refname>openlog</refname>
    <refpurpose>Apre una connessione al logger di sistema</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Descrizione</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> apre una connessione al logger di
     sistema per un programma. La stringa <parameter>ident</parameter> viene
     aggiunta a ogni messaggio. Valori per <parameter>option</parameter>
     e <parameter>facility</parameter> sono dati di seguito.
     L'argomento <parameter>option</parameter> viene usato per indicare
     quali opzioni di loggin verranno usate durante la generazione di un messaggio di log.
     L'argomento <parameter>facility</parameter> viene usato per specificare quale 
     tipo di programma sta loggando il messaggio. Questo permette di specificare
     (nella comfigurazione del syslog della macchina) come trattare i messaggi provenienti dalle
     diverse facility.
     L'uso di <function>openlog</function>  opzionale. Viene
     chiamato automaticamente da <function>syslog</function> se
     necessario, in tal caso <parameter>ident</parameter> sar di default
     &false;.
    </para>
    <para>
     <table>
      <title>Opzioni di <function>openlog</function></title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Costante</entry>
         <entry>Descrizione</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>LOG_CONS</entry>
         <entry>
          se si verifica un errore durante l'invio dei dati al logger di sistema,
          scrive direttamente sulla console di sistema
         </entry>
        </row>
        <row>
         <entry>LOG_NDELAY</entry>
         <entry>
          apre immediatamente una connessione al logger
         </entry>
        </row>
        <row>
         <entry>LOG_ODELAY</entry>
         <entry>
          (default) ritarda l'apertura della connessione fino a quando non viene loggato 
          il primo messaggio
         </entry>
        </row>
        <row>
         <entry>LOG_PERROR</entry>
         <entry>stampa un messaggio di log anche su standard error</entry>
        </row>
        <row>
         <entry>LOG_PID</entry>
         <entry>include il PID in ciascun messaggio</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
     Si possono usare una o pi di queste opzioni. Usando opzioni multiple
      necessario usare <literal>OR</literal>, ad esempio per aprire la connessione 
     immediatamente, scrivere sulla console e il PID in ciascun messaggio, 
     si dovr usare: <literal>LOG_CONS | LOG_NDELAY | LOG_PID</literal>
    </para>
    <para>
     <table>
      <title>Facility di <function>openlog</function></title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Costante</entry>
         <entry>Descrizione</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>LOG_AUTH</entry>
         <entry>
          messaggi di sicurezza/autorizzazione (usa LOG_AUTHPRIV
          nei sistemi dove  definita quella costante)
         </entry>
        </row>
        <row>
         <entry>LOG_AUTHPRIV</entry>
         <entry>messaggi di sicurezza/autorizzazione (private)</entry>
        </row>
        <row>
         <entry>LOG_CRON</entry>
         <entry>clock daemon (cron e at)</entry>
        </row>
        <row>
         <entry>LOG_DAEMON</entry>
         <entry>altri demoni di sistema</entry>
        </row>
        <row>
         <entry>LOG_KERN</entry>
         <entry>messaggi del kernel</entry>
        </row>
        <row>
         <entry>LOG_LOCAL0 ... LOG_LOCAL7</entry>
         <entry>riservato per il locale</entry>
        </row>
        <row>
         <entry>LOG_LPR</entry>
         <entry>sottosistema line printer</entry>
        </row>
        <row>
         <entry>LOG_MAIL</entry>
         <entry>sottosistema mail</entry>
        </row>
        <row>
         <entry>LOG_NEWS</entry>
         <entry>sottosistema news di USENET</entry>
        </row>
        <row>
         <entry>LOG_SYSLOG</entry>
         <entry>messaggi generati internamente da syslogd</entry>
        </row>
        <row>
         <entry>LOG_USER</entry>
         <entry>messaggi generici user-level</entry>
        </row>
        <row>
         <entry>LOG_UUCP</entry>
         <entry>sottosistema UUCP</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     Vedere anche <function>define_syslog_variables</function>,
     <function>syslog</function> e
     <function>closelog</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pfsockopen">
   <refnamediv>
    <refname>pfsockopen</refname>
    <refpurpose>
     Apre una connessione persistente Internet o di tipo domain socket Unix
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</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 choice="opt"><type>int</type><parameter>errno</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>errstr</parameter></methodparam>
      <methodparam choice="opt"><type>int</type><parameter>timeout</parameter></methodparam>
     </methodsynopsis>
    <para>
     Questa funzione si comporta esattamente come <function>fsockopen</function>
     con la differenza che la connessione non viene chiusa dopo che lo script
     ha finito la sua esecuzione. &Egrave; la versione persistente di
     <function>fsockopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.socket-get-status">
   <refnamediv>
    <refname>socket_get_status</refname>
    <refpurpose>
     Restituisce informazioni su una risorsa socket esistente
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>array</type><methodname>socket_get_status</methodname>
      <methodparam><type>resource</type><parameter>socket_get_status</parameter></methodparam>
     </methodsynopsis>
    <para>
     Restituisce informazioni su una risorsa socket esistente. Attualmente
     restituisce quattro campi nell'array risultante:
    </para>
    <itemizedlist>
     <listitem>
      <para>
       <parameter>timed_out</parameter> (bool) - Il socket  andato in time out
       aspettando i dati
      </para>
     </listitem>
     <listitem>
      <para>
       <parameter>blocked</parameter> (bool) - Il socket  bloccato
      </para>
     </listitem>
     <listitem>
      <para>
       <parameter>eof</parameter> (bool) - Indica l'evento EOF
      </para>
     </listitem>
     <listitem>
      <para>
       <parameter>unread_bytes</parameter> (int) - Numero di byte
       rimasti nel buffer del socket
      </para>
     </listitem>
    </itemizedlist>
    <para>
     Vedere anche: <function>socket_accept</function>,
     <function>socket_bind</function>,
     <function>socket_connect</function>,
     <function>socket_listen</function>,
     <function>socket_strerror</function> e la
     <link linkend="ref.sockets">Socket extension</link>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.socket-set-blocking">
   <refnamediv>
    <refname>socket_set_blocking</refname>
    <refpurpose>Imposta un socket in modalit blocking/non-blocking</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>socket_set_blocking</methodname>
      <methodparam><type>int</type><parameter>descrittore del socket</parameter></methodparam>
      <methodparam><type>int</type><parameter>modo</parameter></methodparam>
     </methodsynopsis>
    <para>
     Se <parameter>modo</parameter>  &false;, il dato descrittore del socket
     verr cambiato in modalit non-blocking e se &true;, verr
     cambiato in modalit blocking. Questo ha effetti su chiamate tipo quelle di
     <function>fgets</function> che leggono dirttamente dal socket. In modo
     non-blocking una chiamata a <function>fgets</function> restituir sempre
     subito i dati, mentre in modalit blocking, essa attender che i dati siano
     disponibili nel socket.
    </para>
    <para>
     Questa funzione era precedentemente chiamata
     <function>set_socket_blocking</function>, ma questo uso  deprecato.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.socket-set-timeout">
   <refnamediv>
    <refname>socket_set_timeout</refname>
    <refpurpose>Imposta il tempo di timeout per un socket</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>bool</type><methodname>socket_set_timeout</methodname>
      <methodparam><type>int</type><parameter>descrittore socket</parameter></methodparam>
      <methodparam><type>int</type><parameter>secondi</parameter></methodparam>
      <methodparam><type>int</type><parameter>microsecondi</parameter></methodparam>
     </methodsynopsis>
    <para>
     Imposta il valore di timeout per un <parameter>descrittore socket</parameter>,
     espresso come la somma di <parameter>secondi</parameter> e
     <parameter>microsecondi</parameter>.
     <example>
     <title>Esempio di <function>socket_set_timeout</function></title>
       <programlisting role="php">
<![CDATA[
<?php
$fp = fsockopen("www.php.net", 80);
if(!$fp) {
    echo "Impossibile aprire\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>
     Questa funzione era precedentemente chiamata
     <function>set_socket_timeout</function>, ma questo uso  deprecato.
    </para>
    <para>
     Vedere anche: <function>fsockopen</function> e <function>fopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.syslog">
   <refnamediv>
    <refname>syslog</refname>
    <refpurpose>Genera un messaggio del system log</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Descrizione</title>
     <methodsynopsis>
      <type>int</type><methodname>syslog</methodname>
      <methodparam><type>int</type><parameter>priorit</parameter></methodparam>
      <methodparam><type>string</type><parameter>messaggio</parameter></methodparam>
     </methodsynopsis>
    <para>
     <function>syslog</function> genera un messaggio di log che viene distribuito dal
     logger di sistema.
     <parameter>priorit</parameter>  la combinazione della facility
     e del livello, valori utilizzabili sono riportati nella prossima sezione.
     L'argomento rimanente  il messaggio da inviare, eccetto i 
     due caratteri <literal>%m</literal> che vengono sostituiti dalla
     stringa del messaggio di errore (strerror) corrispondente all'attuale 
     valore di <errortype>errno</errortype>.
    </para>
    <para>
     <table>
      <title>Priorit <function>syslog</function> (in ordine discendente)</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Costante</entry>
         <entry>Descrizione</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>LOG_EMERG</entry>
         <entry>sistema non utilizzabile</entry>
        </row>
        <row>
         <entry>LOG_ALERT</entry>
         <entry>azione da intraprendere immediatamente</entry>
        </row>
        <row>
         <entry>LOG_CRIT</entry>
         <entry>condizioni critiche</entry>
        </row>
        <row>
         <entry>LOG_ERR</entry>
         <entry>condizioni di errore</entry>
        </row>
        <row>
         <entry>LOG_WARNING</entry>
         <entry>condizioni di attenzione</entry>
        </row>
        <row>
         <entry>LOG_NOTICE</entry>
         <entry>condizione normale, ma significativa</entry>
        </row>
        <row>
         <entry>LOG_INFO</entry>
         <entry>messaggio di informazione</entry>
        </row>
        <row>
         <entry>LOG_DEBUG</entry>
         <entry>messaggio a livello di debug</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     <example>
      <title>Uso di <function>syslog</function></title>
      <programlisting role="php">
<![CDATA[
<?php
define_syslog_variables();
// apre il syslog, include l'ID del processo, invia il
// log anche su standard error e fa uso di un meccanismo
// di logging defiito dall'utente
openlog("IlMioLog", LOG_PID | LOG_PERROR, LOG_LOCAL0);

// un po' di codice

if (client_autorizzato()) {
    // fa qualcosa
} else {
    // client non autorizzato!
    // logga il tentativo
    $accesso = date("Y/m/d H:i:s");
    syslog(LOG_WARNING,"Client non autorizzato: $accesso $REMOTE_ADDR ($HTTP_USER_AGENT)");
}

closelog();
?>
]]>
      </programlisting>
     </example>
     Per informazioni su come creare un gestore di log definito dall'utente, fare riferimento alla man page
     <citerefentry><refentrytitle>syslog.conf</refentrytitle>
     <manvolnum>5</manvolnum></citerefentry> di Unix. Ulteriori
     informazioni sulle facility di syslog e sulle sue opzioni possono essere trovate sulle macchine Unix nelle man page
     di <citerefentry><refentrytitle>syslog</refentrytitle>
     <manvolnum>3</manvolnum></citerefentry>.
    </para>
    <para>
     Su Windows NT, il servizio syslog  emulato usando Event
     Log.
    </para>
    <para>
     Vedere anche <function>define_syslog_variables</function>,
     <function>openlog</function> e
     <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:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->