summaryrefslogtreecommitdiff
path: root/improve-inet.mbx
blob: 5c9b5e00f63c36022d82cf45177f845e328aeea3 (plain)
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
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Jun 30 17:19:40 2013
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv4.telemetry-investments.com (ti21 [192.168.78.21])
	by ti119.telemetry-investments.com (Postfix) with ESMTP id F3C66383
	for <schorr@schorr.telemetry-investments.com>; Sun, 30 Jun 2013 17:19:39 -0400 (EDT)
Received: by sv4.telemetry-investments.com (Postfix)
	id E21951CCE; Sun, 30 Jun 2013 17:19:39 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv4.telemetry-investments.com (Postfix) with ESMTP id CC6C41CBB
	for <aschorr@telemetry-investments.com>; Sun, 30 Jun 2013 17:19:39 -0400 (EDT)
Received: from localhost ([::1]:57504 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1UtP23-0005F1-CT
	for aschorr@telemetry-investments.com; Sun, 30 Jun 2013 17:19:39 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39119)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UtP1y-0005EA-Nz
	for gawk-devel@gnu.org; Sun, 30 Jun 2013 17:19:38 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UtP1u-00006i-Dc
	for gawk-devel@gnu.org; Sun, 30 Jun 2013 17:19:34 -0400
Received: from gw3a.telemetry-investments.com ([38.76.0.51]:50548
	helo=sv3.telemetry-investments.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UtP1q-000064-BJ; Sun, 30 Jun 2013 17:19:26 -0400
Received: from ti119.telemetry-investments.com (ti119 [192.168.53.119])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 621041DCB;
	Sun, 30 Jun 2013 17:19:25 -0400 (EDT)
Received: by ti119.telemetry-investments.com (Postfix, from userid 300)
	id 152FA3EC; Sun, 30 Jun 2013 17:19:25 -0400 (EDT)
Date: Sun, 30 Jun 2013 17:19:24 -0400
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
To: Aharon Robbins <arnold@skeeve.com>
Message-ID: <20130630211924.GA17745@ti119.telemetry-investments.com>
References: <20130531144140.GA12968@ti119.telemetry-investments.com>
	<83fvx32ns4.fsf@gnu.org>
	<20130531151439.GA15359@ti119.telemetry-investments.com>
	<83bo7r2mne.fsf@gnu.org>
	<20130531153803.GA16477@ti119.telemetry-investments.com>
	<838v2v2g3b.fsf@gnu.org>
	<20130531181542.GA24861@ti119.telemetry-investments.com>
	<83zjvb0yvq.fsf@gnu.org> <51A91CD6.3010904@fi.upm.es>
	<201306271422.r5REMUgo015427@skeeve.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="6c2NcOVqGQ03X4Wi"
Content-Disposition: inline
In-Reply-To: <201306271422.r5REMUgo015427@skeeve.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
X-Received-From: 38.76.0.51
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] generalizing socket i/o
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Status: RO
X-Status: A
Content-Length: 11770
Lines: 320


--6c2NcOVqGQ03X4Wi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi all,

I started to work on this.  I have encountered a few "challenges" :-).
Here's a test program that demonstrates some basic functionality:

@load "select"
@load "time"

BEGIN {
   start = gettimeofday()
   cmd["echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3"] = ""
   cmd["sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3"] = ""

   # XXX fire up child processes: we need a way to launch them without reading
   # the first line of input!
   for (i in cmd) {
      i | getline x
      printf "%.6f cmd [%s]: %s\n", gettimeofday()-start, i, x
   }
   delete writefds
   delete exceptds
   while (length(cmd) > 0) {
      delete readfds
      for (i in cmd)
         readfds[i] = ""
      switch (select(readfds, writefds, exceptfds)) {
      case -1:
         printf "Error: select failed: %s\n", ERRNO > "/dev/stderr"
         exit 1
      case 0:
         print "Timeout.  Trying again."
         break
      default:
         for (i in readfds) {
            if ((rc = (i | getline x)) > 0)
               printf "%.6f cmd [%s]: %s\n", gettimeofday()-start, i, x
            else {
               delete cmd[i]
               if (rc < 0) {
                  printf "Error: getline(%s) failed, errno = %s\n", i, ERRNO
                  erc = 1
               }
            }
         }
         break
      }
   }
   exit erc+0
}

And the output:

schorr@ti119: ./gawk -f /tmp/multiplex.awk
1.005721 cmd [sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3]: B:msg1
1.007885 cmd [echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3]: A:msg1
2.009040 cmd [echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3]: A:msg2
3.007013 cmd [sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3]: B:msg2
4.008378 cmd [sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3]: B:msg3
4.010283 cmd [echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3]: A:msg3
schorr@ti119: ./gawk -f /tmp/multiplex.awk
1.002733 cmd [sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3]: B:msg1
1.004928 cmd [echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3]: A:msg1
2.006261 cmd [echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3]: A:msg2
3.004054 cmd [sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3]: B:msg2
4.005410 cmd [sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3]: B:msg3
4.007458 cmd [echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3]: A:msg3

I haven't pushed the branch yet, because I'm not quite ready to commit
this code.  I first need to figure out how to solve the following problems:

1. When trying to read from the current input file (i.e. the data found in
the FILENAME), there's a bootstrapping problem.  When the BEGIN rule executes,
the input files have not been opened yet.  So if one tries to lookup the
current value of FILENAME, it is NULL.  In normal execution, when one
calls getline or processes the first line of input the regular way, the
code calls "nextfile(& curfile, false)".  You can see this in "interpret.h"
in the Op_newfile and Op_K_getline sections.  That's what bootstraps the
reading of the files.  After nextfile is called the first time, it returns
a positive value, and this tells the calling code to run the beginfile logic
by executing 'JUMPTO((pc + 1)->target_beginfile'.  I'd like the lookup_file
code to see that curfile is NULL and recognize that it needs to bootstrap
the file reading by calling nextfile(& curfile, false) and then execute
the beginfile rules, but I don't know how to run the BEGINFILE targets.
I would appreciate help with that.

2. I will need a way to bootstrap pipes and coprocess fds.  In the usual case,
gawk calls io.c:redirect() to open a pipe when the first getline call occurs.
In our case, we want to open the popes and/or sockets prior to calling select
the first time.  I will need to add a new open_file API call that takes the
name of a command and redirection type and calls the redirect() function.
My current plan is to change the select calling convention so that the array
value for a given filename contains the requested open mode (one of ">", ">>",
"<", "|&", and "|").  So in the above program, it might say:
   cmd["echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3"] = "|"
   cmd["sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3"] = "|"
Since they appear in the readfds array, we know that this is an input
pipe, not output.

3. The tcp server logic was designed to be single-threaded.  If you try to read
input from a server socket, it waits for a client to connect, closes the
listener socket, and then processes I/O from the newly connected socket.  If I
could start over, I'd change the TCP server mechanism to work something like
this:

   server = "/inet/tcp/8080/0/0"
   while (1) {
      # wait for a client to connect
      server |& getline client
      # at this point, client contains the handle for the connected socket,
      # something like "/inet/tcp/8080/client-host/client-port", and the server
      # socket should still be open to accept new connections!
      while ((client |& getline x) > 0)
	 printf "client %s says: %s\n", client, x
      close(client)
   }

If it had been done that way, it would be easy to use the new select
multiplexing mechanisms to service multiple connected clients at once.
Since it was not designed that way, I'm not sure how best to remedy this.
I guess we can add a function to open a socket to listen for connections,
and another to accept connections, but it may be painful to integrate this
into the existing socket I/O scheme.  A separate BSD-style API would be
easy to implement, but it seems suboptimal to have 2 different approaches
to networking.  Does anbody have any thoughts on how best to solve this?

That's it for now.  The current pre-alpha version of the select extension
is attached.  Arnold's flatten_array API makes it pretty easy -- thanks
Arnold!

I think I know how to solve problem #2, but I'm currently stumped on #1 (I
think I need to find a way to run the rule_block[BEGINFILE] code, but I don't
know how).  I don't consider #3 an urgent problem right now, but we should
figure out how best to handle this to support socket I/O properly.

I haven't started to work on signal support yet.

Regards,
Andy

--6c2NcOVqGQ03X4Wi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="select.c"

/*
 * select.c - Builtin functions to provide select I/O multiplexing.
 */

/*
 * Copyright (C) 2013 the Free Software Foundation, Inc.
 * 
 * This file is part of GAWK, the GNU implementation of the
 * AWK Programming Language.
 * 
 * GAWK is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 * 
 * GAWK is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <sys/types.h>
#include <sys/stat.h>

#include "gawkapi.h"

#include "gettext.h"
#define _(msgid)  gettext(msgid)
#define N_(msgid) msgid

static const gawk_api_t *api;	/* for convenience macros to work */
static awk_ext_id_t *ext_id;
static const char *ext_version = "ordchr extension: version 1.0";
static awk_bool_t (*init_func)(void) = NULL;

int plugin_is_GPL_compatible;

#if defined(HAVE_SELECT) && defined(HAVE_SYS_SELECT_H)
#include <sys/select.h>
#endif

#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif

/*  do_ord --- return numeric value of first char of string */

static awk_value_t *
do_select(int nargs, awk_value_t *result)
{
	static const char *argname[] = { "read", "write", "except" };
	struct {
		awk_value_t array;
		awk_flat_array_t *flat;
		fd_set bits;
		int *array2fd;
	} fds[3];
	awk_value_t timeout_arg;
	int i;
	struct timeval maxwait;
	struct timeval *timeout;
	int nfds = 0;
	int rc;

	if (do_lint && nargs > 5)
		lintwarn(ext_id, _("select: called with too many arguments"));

	for (i = 0; i < sizeof(fds)/sizeof(fds[0]); i++) {
		size_t j;

		if (! get_argument(i, AWK_ARRAY, & fds[i].array)) {
			warning(ext_id, _("select: bad array parameter `%s'"), argname[i]);
			update_ERRNO_string(_("select: bad array parameter"));
			return make_number(-1, result);
		}
		/* N.B. flatten_array fails for empty arrays, so that's OK */
		FD_ZERO(&fds[i].bits);
		if (flatten_array(fds[i].array.array_cookie, &fds[i].flat)) {
			emalloc(fds[i].array2fd, int *, fds[i].flat->count*sizeof(int), "select");
			for (j = 0; j < fds[i].flat->count; j++) {
				const awk_input_buf_t *buf;
				char junk[3];

				if ((buf = lookup_file(fds[i].flat->elements[j].index.str_value.str, fds[i].flat->elements[j].index.str_value.len)) != NULL)
					fds[i].array2fd[j] = buf->fd;
				else if ((sscanf(fds[i].flat->elements[j].index.str_value.str, "%d%s", & fds[i].array2fd[j], junk) != 1) || (fds[i].array2fd[j] < 0)) {
					warning(ext_id, _("select: lookup_file failed on `%s'"), fds[i].flat->elements[j].index.str_value.str);
					update_ERRNO_string(_("select: lookup_file failed"));
					if (! release_flattened_array(fds[i].array.array_cookie, fds[i].flat))
						warning(ext_id, _("select: release_flattened_array failed"));
					free(fds[i].array2fd);
					return make_number(-1, result);
				}
				FD_SET(fds[i].array2fd[j], &fds[i].bits);
				if (nfds <= fds[i].array2fd[j])
					nfds = fds[i].array2fd[j]+1;
			}
		}
		else
			fds[i].flat = NULL;
	}
        if (get_argument(3, AWK_NUMBER, &timeout_arg)) {
		double secs = timeout_arg.num_value;
		if (secs < 0) {
			warning(ext_id, _("select: treating negative timeout as zero"));
			secs = 0;
		}
		maxwait.tv_sec = secs;
		maxwait.tv_usec = (secs-(double)maxwait.tv_sec)*1000000.0;
		timeout = &maxwait;
	} else
		timeout = NULL;
	rc = select(nfds, &fds[0].bits, &fds[1].bits, &fds[2].bits, timeout);

	if (rc < 0) {
		update_ERRNO_int(errno);
		/* bit masks are undefined, so delete all array entries */
		for (i = 0; i < sizeof(fds)/sizeof(fds[0]); i++) {
			if (fds[i].flat) {
				size_t j;
				for (j = 0; j < fds[i].flat->count; j++)
					fds[i].flat->elements[j].flags |= AWK_ELEMENT_DELETE;
				if (! release_flattened_array(fds[i].array.array_cookie, fds[i].flat))
					warning(ext_id, _("select: release_flattened_array failed"));
				free(fds[i].array2fd);
			}
		}
		return make_number(rc, result);
	}

	for (i = 0; i < sizeof(fds)/sizeof(fds[0]); i++) {
		if (fds[i].flat) {
			size_t j;
			/* remove array elements not set in the bit mask */
			for (j = 0; j < fds[i].flat->count; j++) {
				if (! FD_ISSET(fds[i].array2fd[j], &fds[i].bits))
					fds[i].flat->elements[j].flags |= AWK_ELEMENT_DELETE;
			}
			if (! release_flattened_array(fds[i].array.array_cookie, fds[i].flat))
				warning(ext_id, _("select: release_flattened_array failed"));
			free(fds[i].array2fd);
		}
	}

	/* Set the return value */
	return make_number(rc, result);
}

static awk_ext_func_t func_table[] = {
	{ "select", do_select, 5 },
};

/* define the dl_load function using the boilerplate macro */

dl_load_func(func_table, select, "")

--6c2NcOVqGQ03X4Wi--

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Jun 30 21:09:45 2013
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti119.telemetry-investments.com (Postfix) with ESMTP id CF54A383
	for <schorr@schorr.telemetry-investments.com>; Sun, 30 Jun 2013 21:09:45 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id C48A81DC7; Sun, 30 Jun 2013 21:09:45 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id B94DE1DB2
	for <aschorr@telemetry-investments.com>; Sun, 30 Jun 2013 21:09:45 -0400 (EDT)
Received: from localhost ([::1]:48598 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1UtScj-0007iC-IX
	for aschorr@telemetry-investments.com; Sun, 30 Jun 2013 21:09:45 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37742)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UtScf-0007hU-Ai
	for gawk-devel@gnu.org; Sun, 30 Jun 2013 21:09:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UtScc-0004yQ-3z
	for gawk-devel@gnu.org; Sun, 30 Jun 2013 21:09:41 -0400
Received: from gw3a.telemetry-investments.com ([38.76.0.51]:53552
	helo=sv3.telemetry-investments.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UtScc-0004yM-0O
	for gawk-devel@gnu.org; Sun, 30 Jun 2013 21:09:38 -0400
Received: from ti119.telemetry-investments.com (ti119 [192.168.53.119])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 43E4A1DB2;
	Sun, 30 Jun 2013 21:09:37 -0400 (EDT)
Received: by ti119.telemetry-investments.com (Postfix, from userid 300)
	id 2F5B33EC; Sun, 30 Jun 2013 21:09:37 -0400 (EDT)
Date: Sun, 30 Jun 2013 21:09:37 -0400
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
To: Aharon Robbins <arnold@skeeve.com>
Message-ID: <20130701010937.GA21450@ti119.telemetry-investments.com>
References: <83fvx32ns4.fsf@gnu.org>
	<20130531151439.GA15359@ti119.telemetry-investments.com>
	<83bo7r2mne.fsf@gnu.org>
	<20130531153803.GA16477@ti119.telemetry-investments.com>
	<838v2v2g3b.fsf@gnu.org>
	<20130531181542.GA24861@ti119.telemetry-investments.com>
	<83zjvb0yvq.fsf@gnu.org> <51A91CD6.3010904@fi.upm.es>
	<201306271422.r5REMUgo015427@skeeve.com>
	<20130630211924.GA17745@ti119.telemetry-investments.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20130630211924.GA17745@ti119.telemetry-investments.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
X-Received-From: 38.76.0.51
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] pushed first version of select extension
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Status: RO
Content-Length: 4641
Lines: 117

I just pushed a new "select" branch.  It fixes the problem with starting
coprocesses and pipes.

I still don't know how to run the BEGINFILE rule for the first file.
In gawkapi.c:api_get_file, here's where I need help:

        if ((name == NULL) || (namelen == 0)) {
                if (curfile == NULL) {
                        if (nextfile(& curfile, false) <= 0)
                                return NULL;
                        /* XXX Fix me! */
                        fputs("Bug: need to call BEGINFILE!\n", stderr);
                }
                return &curfile->public;
        }

Does anybody know how to solve this?

This test program now works OK:

@load "select"
@load "time"

BEGIN {
   start = gettimeofday()
   cmd["echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3"] = "|<"
   cmd["sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3"] = "|<"

   delete writefds
   delete exceptds
   while (length(cmd) > 0) {
      delete readfds
      for (i in cmd)
	 readfds[i] = cmd[i]
      switch (select(readfds, writefds, exceptfds)) {
      case -1:
	 printf "Error: select failed: %s\n", ERRNO > "/dev/stderr"
	 exit 1
      case 0:
	 print "Timeout.  Trying again."
	 break
      default:
	 for (i in readfds) {
	    if ((rc = (i | getline x)) > 0)
	       printf "%.6f cmd [%s]: %s\n", gettimeofday()-start, i, x
	    else {
	       delete cmd[i]
	       if (rc < 0) {
		  printf "Error: getline(%s) failed, errno = %s\n", i, ERRNO
		  erc = 1
	       }
	    }
	 }
	 break
      }
   }
   exit erc+0
}

Here's the output:
bash-4.1$ ./gawk -f /tmp/multiplex.awk 
0.001883 cmd [echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3]: A:msg1
1.002844 cmd [echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3]: A:msg2
1.003278 cmd [sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3]: B:msg1
3.003809 cmd [echo A:msg1; sleep 1; echo A:msg2; sleep 2; echo A:msg3]: A:msg3
4.005850 cmd [sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3]: B:msg2
4.005888 cmd [sleep 1; echo B:msg1; sleep 2; echo B:msg2; sleep 1; echo B:msg3]: B:msg3

And I am still seeking input on the current behavior of TCP server sockets, as
discussed here:

On Sun, Jun 30, 2013 at 05:19:24PM -0400, Andrew J. Schorr wrote:
> 3. The tcp server logic was designed to be single-threaded.  If you try to read
> input from a server socket, it waits for a client to connect, closes the
> listener socket, and then processes I/O from the newly connected socket.  If I
> could start over, I'd change the TCP server mechanism to work something like
> this:
> 
>    server = "/inet/tcp/8080/0/0"
>    while (1) {
>       # wait for a client to connect
>       server |& getline client
>       # at this point, client contains the handle for the connected socket,
>       # something like "/inet/tcp/8080/client-host/client-port", and the server
>       # socket should still be open to accept new connections!
>       while ((client |& getline x) > 0)
> 	 printf "client %s says: %s\n", client, x
>       close(client)
>    }
> 
> If it had been done that way, it would be easy to use the new select
> multiplexing mechanisms to service multiple connected clients at once.
> Since it was not designed that way, I'm not sure how best to remedy this.
> I guess we can add a function to open a socket to listen for connections,
> and another to accept connections, but it may be painful to integrate this
> into the existing socket I/O scheme.  A separate BSD-style API would be
> easy to implement, but it seems suboptimal to have 2 different approaches
> to networking.  Does anbody have any thoughts on how best to solve this?

It occurs to me to wonder whether anybody actually uses TCP server sockets
in the current implementation.  I suspect it is not heavily used, since
the current features are so limited.  I wonder if it's worth changing it
to work as I suggest above...

My next steps are to implement signal handling and then look at the
behavior of getline with timeouts and non-blocking I/O.  Arnold suggested
having getline return -2 and set ERRNO to ETIMEDOUT (or I guess EAGAIN
for a situation where it would block).  One immediate question that
pops to mind: normally, ERRNO contains a string such as "Connection timed out",
not ETIMEDOUT.  And I assume this message varies based on locale.  So I don't
see how client code could test for this unless we define some global variables
ETIMEDOUT and EGAIN that contain the localized versions of those messages.
Or would it be better to hardwire ERRNO to say "ETIMEDOUT" instead of the
localized error message associated with that?

Regards,
Andy

From juergen.kahrs@googlemail.com Mon Jul  1 11:49:58 2013
Return-Path: <juergen.kahrs@googlemail.com>
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
 ti9.telemetry-investments.com
X-Spam-Level: 
X-Spam-Status: No, score=-2.7 required=10.0 tests=BAYES_00,DKIM_SIGNED,
 DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham
 version=3.3.2
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv4.telemetry-investments.com (ti21 [192.168.78.21])
 by ti119.telemetry-investments.com (Postfix) with ESMTP id DD06C5CF
 for <schorr@schorr.telemetry-investments.com>;
 Mon,  1 Jul 2013 11:49:58 -0400 (EDT)
Received: by sv4.telemetry-investments.com (Postfix)
 id CB4C11D57; Mon,  1 Jul 2013 11:49:58 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54])
 by sv4.telemetry-investments.com (Postfix) with ESMTP id 550C31CBB
 for <aschorr@telemetry-investments.com>; Mon,  1 Jul 2013 11:49:58 -0400 (EDT)
Received: by mail-ee0-f54.google.com with SMTP id t10so2153775eei.41
 for <aschorr@telemetry-investments.com>; Mon, 01 Jul 2013 08:49:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=googlemail.com; s=20120113;
 h=message-id:date:from:user-agent:mime-version:to:subject:references
 :in-reply-to:x-enigmail-version:content-type
 :content-transfer-encoding;
 bh=GYcAQb+FmlcdrJ7m8E9mFvzIkDOnXAFJ2wexQr2a5BM=;
 b=ahG3iNgpQFXJdRAj9uG3EaZheS2obQdinsiYgH2ZBf2ML7xhBIKrXkIl3AkWtEVu5d
 /rhBkF8eGGM+erXQh3LCgzxqiSvi9Mtemg+UYTHh/4uVCj0dhQxvGcSxsJfmf07cO4Ip
 VbJcjGty1vljl8IiBdbS4O3i79uv1/MlupGlvVV0NH27rG2GEa55OaWOhck6HGr7HVwR
 Qvb5Yo7a1EFW+iMVmKDY72DilqfZKE8ksHGvhug7UPwPXobiJtwfP/mxvspEwSQA5O9q
 MM64HP0CxWvCpAYMBMaSfqONIqzbssYhtMoz44V71XL3LXz9mCpdzQvc4AxZ0ExPZI11
 WS+w==
X-Received: by 10.14.48.77 with SMTP id u53mr21449700eeb.154.1372693797199;
 Mon, 01 Jul 2013 08:49:57 -0700 (PDT)
Received: from linux-l5kq.site (ip-109-47-96-38.web.vodafone.de.
 [109.47.96.38])
 by mx.google.com with ESMTPSA id n42sm30617516eeh.15.2013.07.01.08.49.55
 for <aschorr@telemetry-investments.com>
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Mon, 01 Jul 2013 08:49:56 -0700 (PDT)
Message-ID: <51D1A521.2050707@googlemail.com>
Date: Mon, 01 Jul 2013 17:49:53 +0200
From: "=?ISO-8859-1?Q?J=FCrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:17.0) Gecko/20130510 Thunderbird/17.0.6
MIME-Version: 1.0
To: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
Subject: Re: [gawk-devel] pushed first version of select extension
References: <83fvx32ns4.fsf@gnu.org>
 <20130531151439.GA15359@ti119.telemetry-investments.com>
 <83bo7r2mne.fsf@gnu.org>
 <20130531153803.GA16477@ti119.telemetry-investments.com>
 <838v2v2g3b.fsf@gnu.org>
 <20130531181542.GA24861@ti119.telemetry-investments.com>
 <83zjvb0yvq.fsf@gnu.org> <51A91CD6.3010904@fi.upm.es>
 <201306271422.r5REMUgo015427@skeeve.com>
 <20130630211924.GA17745@ti119.telemetry-investments.com>
 <20130701010937.GA21450@ti119.telemetry-investments.com>
In-Reply-To: <20130701010937.GA21450@ti119.telemetry-investments.com>
X-Enigmail-Version: 1.6a1pre
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Spambayes-Classification: ham; 0.05
Status: RO
X-Status: A
Content-Length: 792
Lines: 16

Am 01.07.2013 03:09, schrieb Andrew J. Schorr:
>
> It occurs to me to wonder whether anybody actually uses TCP server sockets
> in the current implementation.  I suspect it is not heavily used, since
> the current features are so limited.  I wonder if it's worth changing it
> to work as I suggest above...

Good question, I also doubt that there are many users.
Now that the extension mechanism is established, we should
reconsider if it really makes sense to have sockets in the main
gawk implementation. If you found a way to implement sockets
in an extension and this extension co-operates nicely with a
"select extension" and you would draw the consequence of
suggesting sockets to be kicked out of the main gawk source
tree into an extension, then I would vote in favour of this idea.


From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Mon Jul  1 12:03:49 2013
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti119.telemetry-investments.com (Postfix) with ESMTP id 6AD291D9E
	for <schorr@schorr.telemetry-investments.com>; Mon,  1 Jul 2013 12:03:49 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 612631D5B; Mon,  1 Jul 2013 12:03:49 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 492C8398
	for <aschorr@telemetry-investments.com>; Mon,  1 Jul 2013 12:03:49 -0400 (EDT)
Received: from localhost ([::1]:60885 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1UtgZx-0007bx-79
	for aschorr@telemetry-investments.com; Mon, 01 Jul 2013 12:03:49 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48848)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UtgZk-0007WN-Eo
	for gawk-devel@gnu.org; Mon, 01 Jul 2013 12:03:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UtgZg-0002yS-3W
	for gawk-devel@gnu.org; Mon, 01 Jul 2013 12:03:36 -0400
Received: from gw3a.telemetry-investments.com ([38.76.0.51]:59949
	helo=sv3.telemetry-investments.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UtgZf-0002yB-Sk
	for gawk-devel@gnu.org; Mon, 01 Jul 2013 12:03:31 -0400
Received: from ti119.telemetry-investments.com (ti119 [192.168.53.119])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 3F3061D5B;
	Mon,  1 Jul 2013 12:03:31 -0400 (EDT)
Received: by ti119.telemetry-investments.com (Postfix, from userid 300)
	id 0EEF521B7; Mon,  1 Jul 2013 12:03:30 -0400 (EDT)
Date: Mon, 1 Jul 2013 12:03:30 -0400
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
To: =?iso-8859-1?Q?J=FCrgen?= Kahrs <juergen.kahrs@googlemail.com>
Message-ID: <20130701160330.GA24098@ti119.telemetry-investments.com>
References: <83bo7r2mne.fsf@gnu.org>
	<20130531153803.GA16477@ti119.telemetry-investments.com>
	<838v2v2g3b.fsf@gnu.org>
	<20130531181542.GA24861@ti119.telemetry-investments.com>
	<83zjvb0yvq.fsf@gnu.org> <51A91CD6.3010904@fi.upm.es>
	<201306271422.r5REMUgo015427@skeeve.com>
	<20130630211924.GA17745@ti119.telemetry-investments.com>
	<20130701010937.GA21450@ti119.telemetry-investments.com>
	<51D1A521.2050707@googlemail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
In-Reply-To: <51D1A521.2050707@googlemail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
X-Received-From: 38.76.0.51
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] pushed first version of select extension
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Status: RO
Content-Length: 3198
Lines: 82

On Mon, Jul 01, 2013 at 05:49:53PM +0200, J=FCrgen Kahrs wrote:
> Am 01.07.2013 03:09, schrieb Andrew J. Schorr:
> > It occurs to me to wonder whether anybody actually uses TCP server so=
ckets
> > in the current implementation.  I suspect it is not heavily used, sin=
ce
> > the current features are so limited.  I wonder if it's worth changing=
 it
> > to work as I suggest above...
>=20
> Good question, I also doubt that there are many users.
> Now that the extension mechanism is established, we should
> reconsider if it really makes sense to have sockets in the main
> gawk implementation. If you found a way to implement sockets
> in an extension and this extension co-operates nicely with a
> "select extension" and you would draw the consequence of
> suggesting sockets to be kicked out of the main gawk source
> tree into an extension, then I would vote in favour of this idea.

I did not intend to propose removing sockets from the main gawk source.  =
I
think it may be possible to improve the current implementation of TCP ser=
ver
sockets.  I am simply proposing that when somebody runs getline on a TCP =
server
socket, instead of closing the server socket and returning data from the =
newly
connected socket, it should instead leave the server socket open and retu=
rn the
new filename for the connected socket.  This would enable a true TCP
multiplexing server to be implemented.  I think this can be done without
changing anything else in the current sockets implementation.

The problem code is in io.c:socketopen() here:

                                if (type =3D=3D SOCK_STREAM) {
                                        int clientsocket_fd =3D INVALID_H=
ANDLE;

                                        struct sockaddr_storage remote_ad=
dr;
                                        socklen_t namelen =3D sizeof(remo=
te_addr);

                                        if (listen(socket_fd, 1) >=3D 0
                                            && (clientsocket_fd =3D accep=
t(socket_fd,
                                                (struct sockaddr *) & rem=
ote_addr,
                                                & namelen)) >=3D 0) {
                                                closemaybesocket(socket_f=
d);
                                                socket_fd =3D clientsocke=
t_fd;
                                                break;
                                        }

It calls listen, then accept, and then close on the server socket fd.  I =
would
remove those calls to accept and close, and just return the server socket=
 after
calling listen.

We then need to have a special input parser for TCP server sockets that
would accept new connections and build a new file handle for the connecte=
d
socket.

I haven't looked at UDP sockets.  There may be a similar problem with UDP
server sockets.

Of course, it would be much simpler to have a normal BSD-style socket
extension.  But it would lose the AWK character of the current implementa=
tion.

Another alternative is to leave the current socket code as is, and simply
add a BSD-style sockets API in an extension.  They should be able to coex=
ist
without any problem.

Regards,
Andy

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Tue Jul  2 12:48:03 2013
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti119.telemetry-investments.com (Postfix) with ESMTP id AB5B1369
	for <schorr@schorr.telemetry-investments.com>; Tue,  2 Jul 2013 12:48:03 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 9DF821D39; Tue,  2 Jul 2013 12:48:03 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 8DD0753
	for <aschorr@telemetry-investments.com>; Tue,  2 Jul 2013 12:48:03 -0400 (EDT)
Received: from localhost ([::1]:48820 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1Uu3kJ-0003yd-G9
	for aschorr@telemetry-investments.com; Tue, 02 Jul 2013 12:48:03 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53199)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1Uu3kC-0003xR-V3
	for gawk-devel@gnu.org; Tue, 02 Jul 2013 12:48:00 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1Uu3k9-0003W7-7e
	for gawk-devel@gnu.org; Tue, 02 Jul 2013 12:47:56 -0400
Received: from gw3a.telemetry-investments.com ([38.76.0.51]:39707
	helo=sv3.telemetry-investments.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1Uu3k9-0003Vy-2n
	for gawk-devel@gnu.org; Tue, 02 Jul 2013 12:47:53 -0400
Received: from ti119.telemetry-investments.com (ti119 [192.168.53.119])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 667FB53;
	Tue,  2 Jul 2013 12:47:52 -0400 (EDT)
Received: by ti119.telemetry-investments.com (Postfix, from userid 300)
	id 5060D5CF; Tue,  2 Jul 2013 12:47:52 -0400 (EDT)
Date: Tue, 2 Jul 2013 12:47:52 -0400
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
To: Aharon Robbins <arnold@skeeve.com>
Message-ID: <20130702164752.GB18395@ti119.telemetry-investments.com>
References: <838v2v2g3b.fsf@gnu.org>
	<20130531181542.GA24861@ti119.telemetry-investments.com>
	<83zjvb0yvq.fsf@gnu.org> <51A91CD6.3010904@fi.upm.es>
	<201306271422.r5REMUgo015427@skeeve.com>
	<20130630211924.GA17745@ti119.telemetry-investments.com>
	<20130701010937.GA21450@ti119.telemetry-investments.com>
	<201307011902.r61J2E13003608@skeeve.com>
	<20130701190647.GA25744@ti119.telemetry-investments.com>
	<201307011914.r61JECgh003720@skeeve.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201307011914.r61JECgh003720@skeeve.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
X-Received-From: 38.76.0.51
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] select branch status
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Status: RO
Content-Length: 3780
Lines: 111

Hi,

I just pushed code that seems to work.  Calls to getline should return -2
when an operation would block or timed out.

Here is some sample code to demonstrate that it works:

@load "select"
@load "time"

BEGIN {
   cmd["echo msg1; echo msg2; sleep 1; echo msg3"] = "|<"
   cmd["echo B:msg1; sleep 3; echo B:msg2; echo B:msg3; sleep 1; echo B:msg4"] = "|<"
   for (i in cmd)
      set_non_blocking(i, cmd[i])

   delete writefds
   delete exceptds
   start = gettimeofday()
   while (length(cmd) > 0) {
      delete readfds
      for (i in cmd)
	 readfds[i] = cmd[i]
      switch (select(readfds, writefds, exceptfds)) {
      case -1:
	 printf "Error: select failed: %s\n", ERRNO > "/dev/stderr"
	 exit 1
      case 0:
	 print "Timeout.  Trying again."
	 break
      default:
	 for (i in readfds) {
	    while ((rc = (i | getline x)) > 0)
	       printf "%.1f cmd [%s]: %s\n", gettimeofday()-start, i, x
	    if (rc != -2) {
	       delete cmd[i]
	       if (rc < 0) {
		  printf "Error: getline(%s) failed, errno = %s\n", i, ERRNO
		  erc = 1
	       }
	    }
	 }
	 break
      }
   }
   exit erc+0
}

bash-4.1$ gawk -f /tmp/bufferbug.awk 
0.0 cmd [echo B:msg1; sleep 3; echo B:msg2; echo B:msg3; sleep 1; echo B:msg4]: B:msg1
0.0 cmd [echo msg1; echo msg2; sleep 1; echo msg3]: msg1
0.0 cmd [echo msg1; echo msg2; sleep 1; echo msg3]: msg2
1.0 cmd [echo msg1; echo msg2; sleep 1; echo msg3]: msg3
3.0 cmd [echo B:msg1; sleep 3; echo B:msg2; echo B:msg3; sleep 1; echo B:msg4]: B:msg2
3.0 cmd [echo B:msg1; sleep 3; echo B:msg2; echo B:msg3; sleep 1; echo B:msg4]: B:msg3
4.0 cmd [echo B:msg1; sleep 3; echo B:msg2; echo B:msg3; sleep 1; echo B:msg4]: B:msg4

Everything now prints at the correct time.

There is one thing that took me by surprise.  In io.c:wait_any, I had to
make the following patch:

@@ -2210,12 +2210,13 @@ wait_any(int interesting)	/* pid of interest, if any */
 				if (pid == redp->pid) {
 					redp->pid = -1;
 					redp->status = status;
-					break;
+					goto finished;
 				}
 		}
 		if (pid == -1 && errno == ECHILD)
 			break;
 	}
+finished:
 	signal(SIGHUP, hstat);
 	signal(SIGQUIT, qstat);
 #endif

I would appreciate it if you can check my logic.  Without the patch, gawk hangs
in wait_any(0) waiting for children after the first child returns EOF.  It
loops over calls to wait until wait returns -1.  The patch tells it to
return from wait_any after it reaps one child.  Is there a reason for the
existing behavior where it waits until it has reaped all children?

I'm also not 100% confident that my patches to io.c are correct.  It does
pass "make check" successfully.

Overall, I think it basically works.  I am aware of 3 outstanding issues.
The first is the big one.

1. I need to find a way to patch gawkapi.c:api_get_file to run the BEGINFILE
code after opening the first input file.  Any guidance on this would be
appreciated.

2. I added 2 hooks to the api: lookup_file, and get_file.  In the end, I am
using only get_file.  Is it worth leaving lookup_file in place, or should
it be withdrawn?  I'm not sure how useful it is.

3. Regarding the existing TCP/UDP server paradigm: I'm not sure whether it's
worth changing the existing approach.  It may make more sense to add a separate
extension for supporting servers properly that gives a bit more control.  The
existing scheme works fine for clients, but I don't think it really works for
servers.  I'm open to ideas on this.  It's really a separate discussion.

FYI, I tested the new "select" branch on Cygwin.  It passes "make check",
and the sample code above works properly.  It also seems to catch signals,
although it looks like the Cygwin select call is not interrupted by signals,
so they won't be detected until something else causes the select to exit.

Regards,
Andy

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Tue Jul  2 22:54:33 2013
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv4.telemetry-investments.com (ti21 [192.168.78.21])
	by ti119.telemetry-investments.com (Postfix) with ESMTP id 86597383
	for <schorr@schorr.telemetry-investments.com>; Tue,  2 Jul 2013 22:54:33 -0400 (EDT)
Received: by sv4.telemetry-investments.com (Postfix)
	id 74C251D67; Tue,  2 Jul 2013 22:54:33 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv4.telemetry-investments.com (Postfix) with ESMTP id 5BA461D64
	for <aschorr@telemetry-investments.com>; Tue,  2 Jul 2013 22:54:33 -0400 (EDT)
Received: from localhost ([::1]:42020 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1UuDDF-0002YQ-1m
	for aschorr@telemetry-investments.com; Tue, 02 Jul 2013 22:54:33 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46202)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UuDD9-0002YI-RJ
	for gawk-devel@gnu.org; Tue, 02 Jul 2013 22:54:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UuDD4-0006TK-NQ
	for gawk-devel@gnu.org; Tue, 02 Jul 2013 22:54:27 -0400
Received: from gw3a.telemetry-investments.com ([38.76.0.51]:40225
	helo=sv3.telemetry-investments.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <schorr@telemetry-investments.com>)
	id 1UuDD4-0006TB-J1
	for gawk-devel@gnu.org; Tue, 02 Jul 2013 22:54:22 -0400
Received: from ti119.telemetry-investments.com (ti119 [192.168.53.119])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 8DE611D3C;
	Tue,  2 Jul 2013 22:54:21 -0400 (EDT)
Received: by ti119.telemetry-investments.com (Postfix, from userid 300)
	id 6398B1DAC; Tue,  2 Jul 2013 22:54:21 -0400 (EDT)
Date: Tue, 2 Jul 2013 22:54:21 -0400
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
To: Aharon Robbins <arnold@skeeve.com>
Message-ID: <20130703025421.GA30141@ti119.telemetry-investments.com>
References: <51A91CD6.3010904@fi.upm.es>
	<201306271422.r5REMUgo015427@skeeve.com>
	<20130630211924.GA17745@ti119.telemetry-investments.com>
	<20130701010937.GA21450@ti119.telemetry-investments.com>
	<201307011902.r61J2E13003608@skeeve.com>
	<20130701190647.GA25744@ti119.telemetry-investments.com>
	<201307011914.r61JECgh003720@skeeve.com>
	<20130702164752.GB18395@ti119.telemetry-investments.com>
	<20130702202334.GA14710@ti119.telemetry-investments.com>
	<20130702210648.GA6597@ti119.telemetry-investments.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="ZPt4rx8FFjLCG7dd"
Content-Disposition: inline
In-Reply-To: <20130702210648.GA6597@ti119.telemetry-investments.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
X-Received-From: 38.76.0.51
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] select branch with support for select, signals,
 and non-blocking I/O support: mission accomplished?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Status: RO
Content-Length: 5781
Lines: 150


--ZPt4rx8FFjLCG7dd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I committed the patch to get the BEGINFILE rules to work.  I also withdrew
the unused lookup_file API, since I think it is perhaps unwise.

I have done some simple testing on Linux and Cygwin.  I am attaching
a simple test script that exercises some of the features.  You should
send a SIGINT to the process to see what happens.

You can find the code in the "select" git branch, or you can try this
tarball: http://sourceforge.net/projects/gawkextlib/files/gawk-select.tar.xz

Here is a summary of the changes.  I haven't written any test cases or
documentation yet.  I guess the first question is whether the changes
to the core gawk distribution will be accepted.  If yes, then there's a 
question of whether the two new extensions should be in the core distribution
as well.

Changes to gawk core:
- The numeric value of errno corresponding to the ERRNO variable can
  now be found in PROCINFO["errno"].
- The gawk API has a new "get_file" hook that will find or open a file.
  It takes 2 arguments: the usual awk filename, plus a file type:
     ">", ">>", "<", "|>", "|<", or "|&"
- When an I/O operation fails due to a timeout, interrupt, or because it would
  block, getline should now return -2 and NOT close the file.
- Fixed what appears to be a bug in wait_any that caused it to wait for
  all child processes to exit instead of just one.

New errno extension providing 3 functions:
- strerror(<integer errno value>) returns the strerror value, else ""
  for an invalid argument.
- errno2name(<integer errno value>) returns the symbolic name for an errno,
  else "" for an unknown value.
- name2errno(<string error name>) returns the symbolic name for an errno, else
  -1 on error.

Examples:
   bash-4.1$ echo 11 | gawk -l errno '{print errno2name($1), strerror($1)}'
   EAGAIN Resource temporarily unavailable
   bash-4.1$ echo EAGAIN | gawk -l errno '{print name2errno($1)}'
   11

New select extension providing 3 functions:
- select_signal(<signal name>, {default|ignore|trap})
  Returns 0 on success or -1 on error.  Any trapped signals will be reported
  in the results from the select function.
- set_non_blocking(<command>, <command type>)
  Returns 0 on success and -1 on error.  The command is a normal gawk-style
  command string, and the file type is one of:
     ">", ">>", "<", "|>", "|<", or "|&"
  Note: if the <command> has a numeric value and the <command type> is
  omitted or empty, the function treats the argument as an integer fd value
  and sets it to non-blocking.
- select(<readfds>, <writefds>, <exceptfds>, <timeout>, <signals>)
  Returns -1 on error or the number of file descriptors that matched.
  On return, the <signals> array contains a list of signals that were trapped
  since the last call.  The index is the signal number, and the value
  will be the symbolic signal name (e.g. "INT") if we are able to look it up.
  If <timeout> is present and numeric, that is the maximum number of seconds
  to wait.  Otherwise, it will block indefinitely.
  The <readfds>, <writefds>, and <exceptfds> arrays will have the <command>
  in the index, and the <command type> as the value.  This works the same
  way as the set_non_blocking function.  If the index value is numeric
  and the value is "", it will be treated as a file descriptor.

One note regarding signal behavior: the extension uses sigaction to request
that signal calls be restarted.  But on Linux, the "select" is always
interrupted in any case.  So that's nice -- the signals get delivered quickly.
On Cygwin, I noticed that select does seem to restart, so the signal is
not delivered to the application right away.

That's all I can think of.  Please test it and let me know if it works for you.
Feedback on the design would also be appreciated.

As I mentioned previously, TCP and UDP servers do not work well because of the
design of the current socket implementation.  We may need to write a new
sockets extension to implement servers properly.  To do so my require a
new API function that allows an extension to insert a file descriptor
(and associated filename) into the io.c:red_head struct redirect list.
I think it basically just needs an additional fd arg for a file that is
already open.

I will now return to my day job. :-)

Regards,
Andy

--ZPt4rx8FFjLCG7dd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="multiplex.awk"

@load "select"
@load "time"
@load "errno"

BEGIN {
   print "My pid is", PROCINFO["pid"]
   select_signal("int", "trap")

   cmd["echo A:msg1; sleep 2; echo A:msg2; echo A:backtoback; sleep 4; echo A:msg3"] = "|<"
   cmd["sleep 3; echo B:msg1; echo B:again; sleep 2; echo B:msg2; sleep 4; echo B:msg3"] = "|<"

   for (i in cmd)
      set_non_blocking(i, cmd[i])

   delete writefds
   delete exceptds
   start = gettimeofday()
   EINTR = name2errno("EINTR")
   while (length(cmd) > 0) {
      delete readfds
      for (i in cmd)
	 readfds[i] = cmd[i]
      rc = select(readfds, writefds, exceptfds, "", sigs)
      for (i in sigs)
	 printf "Caught signal %d (%s)\n", i, sigs[i]
      switch (rc) {
      case -1:
	 if (PROCINFO["errno"] == EINTR) {
	    print "Select failed due to EINTR; trying again."
	    break
	 }
	 printf "Error: select failed: %s\n", ERRNO > "/dev/stderr"
	 exit 1
      case 0:
	 print "Timeout.  Trying again."
	 break
      default:
	 for (i in readfds) {
	    while ((rc = (i | getline x)) > 0)
	       printf "%.1f cmd [%s]: %s\n", gettimeofday()-start, i, x
	    if (rc != -2) {
	       delete cmd[i]
	       if (rc < 0) {
		  printf "Error: getline(%s) failed, errno = %s\n", i, ERRNO
		  erc = 1
	       }
	    }
	 }
	 break
      }
   }
   exit erc+0
}

--ZPt4rx8FFjLCG7dd--

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Feb 28 13:06:51 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id C667F3D0
	for <schorr@schorr.telemetry-investments.com>; Sun, 28 Feb 2016 13:06:51 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id B6C286C2; Sun, 28 Feb 2016 13:06:51 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 58283343
	for <aschorr@telemetry-investments.com>; Sun, 28 Feb 2016 13:06:50 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 58283343
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=gnu.org
Received: from localhost ([::1]:60088 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1aa5k1-0007bK-A3
	for aschorr@telemetry-investments.com; Sun, 28 Feb 2016 13:06:49 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52225)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eliz@gnu.org>) id 1aa5jz-0007bE-Sl
	for gawk-devel@gnu.org; Sun, 28 Feb 2016 13:06:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eliz@gnu.org>) id 1aa5jv-0006oM-QF
	for gawk-devel@gnu.org; Sun, 28 Feb 2016 13:06:47 -0500
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:39708)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@gnu.org>)
	id 1aa5jv-0006o9-Mx
	for gawk-devel@gnu.org; Sun, 28 Feb 2016 13:06:43 -0500
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3515
	helo=home-c4e4a596f7)
	by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
	(Exim 4.82) (envelope-from <eliz@gnu.org>) id 1aa5jv-0004Qr-0A
	for gawk-devel@gnu.org; Sun, 28 Feb 2016 13:06:43 -0500
Date: Sun, 28 Feb 2016 20:06:28 +0200
Message-Id: <83egbwaevv.fsf@gnu.org>
From: Eli Zaretskii <eliz@gnu.org>
To: gawk-devel@gnu.org
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
Subject: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: Eli Zaretskii <eliz@gnu.org>
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 208
Lines: 5

I tried the UDP server/client example from the manual today, and it
didn't work for me with Gawk 4.1.3, neither on MS-Windows nor on
GNU/Linux.  Did some code bitrot?  Can anyone make that example work?

TIA

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Feb 28 15:02:35 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id BAD7F3DA
	for <schorr@schorr.telemetry-investments.com>; Sun, 28 Feb 2016 15:02:35 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id AC8566C2; Sun, 28 Feb 2016 15:02:35 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 5B1843E8
	for <aschorr@telemetry-investments.com>; Sun, 28 Feb 2016 15:02:35 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 5B1843E8
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=RwRCZR2u
Received: from localhost ([::1]:60457 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1aa7Y1-00088j-Cf
	for aschorr@telemetry-investments.com; Sun, 28 Feb 2016 15:02:33 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49063)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1aa7Xy-00088c-3Y
	for gawk-devel@gnu.org; Sun, 28 Feb 2016 15:02:31 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1aa7Xu-0002ED-QH
	for gawk-devel@gnu.org; Sun, 28 Feb 2016 15:02:30 -0500
Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:37593)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1aa7Xu-0002E9-F7
	for gawk-devel@gnu.org; Sun, 28 Feb 2016 15:02:26 -0500
Received: by mail-wm0-x236.google.com with SMTP id p65so21158646wmp.0
	for <gawk-devel@gnu.org>; Sun, 28 Feb 2016 12:02:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:to:references:message-id:date:user-agent:mime-version
	:in-reply-to; bh=Cq/AQONrS5Pc0V122Lte12/axF+wQQ/P0zJJrFV0yaY=;
	b=RwRCZR2uUbOEfSnjhwtFNcV7wuEeC2jcXTAuYcExCGVY5lDERreclYQVXVRTqkf/4H
	unum7ZVDmMPnl9uRzyMzn/jjy1FDmg3jgaOAa1HWYo5hMs5obZkoxFW6J+/o90ieEfHb
	krQmcuiUW+A5uNClN42xsIelftRZ552j6eL7wlJO9C/l7YB5UJ2T6qNQwOrFyLlln2+4
	0q5SPZPsrrmt79pPHRjnTwH2MsMboIHBIBUbu4Kjv7EvBBxCcY7SUZYlRVkVDX7ay+j/
	JB4do9LVtNu9yEerLih3W9T+EtBCIPdjieOAtJir3UEc4LqsT1g1oxqspBs6oemgwBmO
	EDqQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:to:references:message-id:date
	:user-agent:mime-version:in-reply-to;
	bh=Cq/AQONrS5Pc0V122Lte12/axF+wQQ/P0zJJrFV0yaY=;
	b=M6s4xeBthPgzXf3L//yeNSBxsIh8mwRIrQgVN5XW4xak/X1Kf8G40m1IAzTQl1SgmE
	2Vr3oeuUFpjfpZzb2Yc2d/nDUGmLdyn423P/C+l581TvQQsuoo87C63b9/riStxaiDcD
	aC9NBpEa/9KN71h4JRYrNOnPIg+Ob+2uES8nlEH1ra9sV1zq/4yMTU0vV3hZj60JZU1p
	VfiiX8PqN5Uw2EPU5BwJ9vFIvfcpe2X6S3nKMgfFrwYjXAPmMzbKJxOQD6LidXDeX6l2
	5g0vQwWTWAd6P9cf0y5dmSpfFsXCYugvIn/9AMoI1X5DUWeUMMHCF54RkKH0crcAcAw6
	WcDA==
X-Gm-Message-State: AD7BkJKkMZOjQDlJvcYuseem7nVI0fN6fFectUfb+DWhZPQH6O7bG8D2AQ022CfqbM9gEA==
X-Received: by 10.194.82.41 with SMTP id f9mr11255322wjy.139.1456689745459;
	Sun, 28 Feb 2016 12:02:25 -0800 (PST)
Received: from [192.168.0.11] (ip5f5ac869.dynamic.kabel-deutschland.de.
	[95.90.200.105]) by smtp.googlemail.com with ESMTPSA id
	x66sm12958996wmb.20.2016.02.28.12.02.24 for <gawk-devel@gnu.org>
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 28 Feb 2016 12:02:24 -0800 (PST)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
To: gawk-devel@gnu.org
References: <83egbwaevv.fsf@gnu.org>
Message-ID: <56D3524F.1040600@googlemail.com>
Date: Sun, 28 Feb 2016 21:02:23 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <83egbwaevv.fsf@gnu.org>
Content-Type: multipart/alternative;
	boundary="------------050908080004020900060306"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::236
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 2916
Lines: 76

This is a multi-part message in MIME format.
--------------050908080004020900060306
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit

Am 28.02.2016 um 19:06 schrieb Eli Zaretskii:
> I tried the UDP server/client example from the manual today, and it
> didn't work for me with Gawk 4.1.3, neither on MS-Windows nor on
> GNU/Linux.  Did some code bitrot?  Can anyone make that example work?

I can reproduce the problem with Gawk 4.1.1.
Both (UDP server and UDP client) don't work correctly.

The UDP server can receive data (I tested this by
sending him data with the netcat tool), but the UDP
server cannot reply. The problem seems to have to
do with an unrecognized address family (in io.c)  that
is passed to the "connect" function when connecting
to remote_addr.

The UDP client cannot send data. After successful
connection, something in the interpreter tries to do
an

    lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)

These problems have probably come up at the time when
the gethostbyname() was replaced with getaddrinfo().
I vaguely remember that only the TCP connections were
tested at that time and the UDP connections did not work.


--------------050908080004020900060306
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Am 28.02.2016 um 19:06 schrieb Eli
      Zaretskii:<br>
    </div>
    <blockquote cite="mid:83egbwaevv.fsf@gnu.org" type="cite">
      <pre wrap="">I tried the UDP server/client example from the manual today, and it
didn't work for me with Gawk 4.1.3, neither on MS-Windows nor on
GNU/Linux.  Did some code bitrot?  Can anyone make that example work?</pre>
    </blockquote>
    <br>
    I can reproduce the problem with Gawk 4.1.1.<br>
    Both (UDP server and UDP client) don't work correctly.<br>
    <br>
    The UDP server can receive data (I tested this by<br>
    sending him data with the netcat tool), but the UDP<br>
    server cannot reply. The problem seems to have to<br>
    do with an unrecognized address family (in io.c)  that<br>
    is passed to the "connect" function when connecting<br>
    to remote_addr.<br>
    <br>
    The UDP client cannot send data. After successful<br>
    connection, something in the interpreter tries to do<br>
    an <br>
    <blockquote><tt>lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE
        (Illegal seek)</tt><br>
    </blockquote>
    These problems have probably come up at the time when<br>
    the gethostbyname() was replaced with getaddrinfo().<br>
    I vaguely remember that only the TCP connections were<br>
    tested at that time and the UDP connections did not work.<br>
    <br>
  </body>
</html>

--------------050908080004020900060306--

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Mon Feb 29 00:30:38 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 614473D0
	for <schorr@schorr.telemetry-investments.com>; Mon, 29 Feb 2016 00:30:38 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id 526866C2; Mon, 29 Feb 2016 00:30:38 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 2A51B3B2
	for <aschorr@telemetry-investments.com>; Mon, 29 Feb 2016 00:30:37 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 2A51B3B2
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=skeeve.com
Received: from localhost ([::1]:34211 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1aaGPj-0000KV-NV
	for aschorr@telemetry-investments.com; Mon, 29 Feb 2016 00:30:35 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:40478)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1aaGP1-0007lJ-BT
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 00:29:52 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1aaGOy-0007Mk-4A
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 00:29:51 -0500
Received: from mxout7.netvision.net.il ([194.90.6.2]:36840)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1aaGOx-0007Md-SM
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 00:29:48 -0500
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; CHARSET=US-ASCII
Received: from skeeve.com ([89.138.173.41]) by mxout7.netvision.net.il
	(Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit
	(built Nov
	17 2011)) with ESMTPSA id <0O3A00EU2N9MH570@mxout7.netvision.net.il>
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 07:29:47 +0200 (IST)
Received: from skeeve.com (skeeve.com [127.0.0.1])
	by skeeve.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id
	u1T5TkTw002992; Mon, 29 Feb 2016 07:29:46 +0200
Received: (from arnold@localhost)	by skeeve.com (8.14.4/8.14.4/Submit)
	id u1T5Tk2m002991; Mon, 29 Feb 2016 07:29:46 +0200
From: Aharon Robbins <arnold@skeeve.com>
Message-id: <201602290529.u1T5Tk2m002991@skeeve.com>
Date: Mon, 29 Feb 2016 07:29:46 +0200
To: juergen.kahrs@googlemail.com, gawk-devel@gnu.org
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
In-reply-to: <56D3524F.1040600@googlemail.com>
User-Agent: Heirloom mailx 12.5 6/20/10
X-detected-operating-system: by eggs.gnu.org: Solaris 10
X-Received-From: 194.90.6.2
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 1486
Lines: 40

Hi Juergen,

Can you take a look at making this work again?  It's entirely possible
I messed something up when I moved to getaddrinfo.  I don't have tons
of cycles at the moment, so I could use some help on this.

Thanks!

Arnold

> From: "J??rgen Kahrs" <juergen.kahrs@googlemail.com>
> To: gawk-devel@gnu.org
> Date: Sun, 28 Feb 2016 21:02:23 +0100
> Subject: Re: [gawk-devel] UDP networking doesn't work?
>
> Am 28.02.2016 um 19:06 schrieb Eli Zaretskii:
> > I tried the UDP server/client example from the manual today, and it
> > didn't work for me with Gawk 4.1.3, neither on MS-Windows nor on
> > GNU/Linux.  Did some code bitrot?  Can anyone make that example work?
>
> I can reproduce the problem with Gawk 4.1.1.
> Both (UDP server and UDP client) don't work correctly.
>
> The UDP server can receive data (I tested this by
> sending him data with the netcat tool), but the UDP
> server cannot reply. The problem seems to have to
> do with an unrecognized address family (in io.c)  that
> is passed to the "connect" function when connecting
> to remote_addr.
>
> The UDP client cannot send data. After successful
> connection, something in the interpreter tries to do
> an
>
>     lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
>
> These problems have probably come up at the time when
> the gethostbyname() was replaced with getaddrinfo().
> I vaguely remember that only the TCP connections were
> tested at that time and the UDP connections did not work.

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Mon Feb 29 13:13:12 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 4DC6029C
	for <schorr@schorr.telemetry-investments.com>; Mon, 29 Feb 2016 13:13:12 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id 42CB56AA; Mon, 29 Feb 2016 13:13:12 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 02637461
	for <aschorr@telemetry-investments.com>; Mon, 29 Feb 2016 13:13:11 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 02637461
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=ELI7Fpwy
Received: from localhost ([::1]:38243 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1aaSJh-00057A-Pk
	for aschorr@telemetry-investments.com; Mon, 29 Feb 2016 13:13:09 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53255)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1aaSJf-00056o-Jh
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 13:13:08 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1aaSJb-0001Do-Fn
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 13:13:07 -0500
Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:38544)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1aaSJb-0001DD-5o
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 13:13:03 -0500
Received: by mail-wm0-x231.google.com with SMTP id l68so1118675wml.1
	for <gawk-devel@gnu.org>; Mon, 29 Feb 2016 10:13:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:to:references:message-id:date:user-agent:mime-version
	:in-reply-to:content-transfer-encoding;
	bh=LYTtAdT/UTx3E0EOPZ595YTbfBQ4SzHOiOmeFLdwIuU=;
	b=ELI7FpwyCNH39JzOKAYDgP4ACtlIVyPZzuTDB2qSsAW+kkUG9IC/R9Yj7py9JUEP4k
	CyjuCLHp0wHigLDb1y3gusEY8RC6lvNzQUbL/dcvRga0zFDbI6fuNG71r5hmZ7Idj4xr
	X8WyYCTnqYHyF/dDnjA1dAdvlHQsLWL3vBw9hpSWPsk+9t3jiMfnqItwZyS8VJj1ocfM
	zxKQ3bN+eiG4JefyRs5Gdt+6IFuqT+sBNmFd5TmsIpRL8aMpRX8fGeOtLtKNHWN8bWr0
	LjpFmZ/SSDfxbAVv0XfCZYa4mbS+k6RyYkAhc7nOFnknZcLGsOry2LZW+5te9nSAAcTQ
	vdNQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:to:references:message-id:date
	:user-agent:mime-version:in-reply-to:content-transfer-encoding;
	bh=LYTtAdT/UTx3E0EOPZ595YTbfBQ4SzHOiOmeFLdwIuU=;
	b=k+Duxz6/ZDIymj+zkUUTdh1h5BQp4ba+y3U8Aj2J0TxZNX0fT6xQvnMlJEY5bj5X6U
	LXG5Lau75WXnChtO3FmyzBzUPMFuxEfUTo9BvEOc4Xkzh2sYlkxcr54yynXBrnt49YRo
	7/LSHb5u98AdzOHLxnlm3HBF+cnOZicXVVDOPVNhMNXUSIV5v7z9XTOcpes0dJ4dTTSX
	AoZ7wyLqjl6tl4fCecDT6M5v3DjFMDIVNzO0pDzbc+D3X92MTSxj/VqNIrqC5oUZTJZR
	yAZhk9r2oWLLR0qVp0hkSJ8KwSQjM3UXhX69c4BE/AsV8uGpDFRuCFZ+PWercP13LDgo
	2hTA==
X-Gm-Message-State: AD7BkJKeJaKUvv+6rpjXy20P3M7QJj/o5c0lxoVNL6KFfxvvp2/rfUKuwdQKlselH7nMfQ==
X-Received: by 10.28.125.211 with SMTP id y202mr12249564wmc.18.1456769582130; 
	Mon, 29 Feb 2016 10:13:02 -0800 (PST)
Received: from [192.168.0.11] (ip5f5ac8a2.dynamic.kabel-deutschland.de.
	[95.90.200.162]) by smtp.googlemail.com with ESMTPSA id
	y62sm11675328wmg.12.2016.02.29.10.13.01 for <gawk-devel@gnu.org>
	(version=TLSv1/SSLv3 cipher=OTHER);
	Mon, 29 Feb 2016 10:13:01 -0800 (PST)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
To: gawk-devel@gnu.org
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
Message-ID: <56D48A2C.4040702@googlemail.com>
Date: Mon, 29 Feb 2016 19:13:00 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <201602290529.u1T5Tk2m002991@skeeve.com>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::231
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
X-Status: A
Content-Length: 485
Lines: 11

Am 29.02.2016 um 06:29 schrieb Aharon Robbins:
> Can you take a look at making this work again?  It's entirely possible
> I messed something up when I moved to getaddrinfo.  I don't have tons
> of cycles at the moment, so I could use some help on this.

The internal data structures to be used with
sockets today are very different from what we
have learned by reading Richard Stevens' books.
I will have a look at it next weekend.
If I find a solution, then I will send you a patch.


From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Mon Feb 29 15:39:54 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id BB5373DA
	for <schorr@schorr.telemetry-investments.com>; Mon, 29 Feb 2016 15:39:54 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id B07986AA; Mon, 29 Feb 2016 15:39:54 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 7A5D35A4
	for <aschorr@telemetry-investments.com>; Mon, 29 Feb 2016 15:39:54 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 7A5D35A4
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=telemetry-investments.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=fail reason="key not found in DNS" (0-bit key) header.d=telemetry-investments.com header.i=@telemetry-investments.com header.b=WuAqrgOQ
Received: from localhost ([::1]:39058 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1aaUbi-0001jM-1W
	for aschorr@telemetry-investments.com; Mon, 29 Feb 2016 15:39:54 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59661)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1aaUbf-0001jF-Ct
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 15:39:52 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1aaUbc-0006B1-5z
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 15:39:51 -0500
Received: from gw3a.telemetry-investments.com ([38.76.0.51]:55015
	helo=sv3.telemetry-investments.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1aaUbc-0006Ac-2D
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 15:39:48 -0500
Received: from ti129.telemetry-investments.com (ti129 [192.168.53.129])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 175D75A4;
	Mon, 29 Feb 2016 15:39:46 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=telemetry-investments.com; s=tele1409; t=1456778386;
	bh=vb6o7x2lB1cZ1DAEnKzPcIXMSA7cfBXegjPCPBg6EJk=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=WuAqrgOQewxUTuy+uILJtYmQBEiBrfBFcEx1tBRRuCSQnejkmBw2Jx0IpcQ0L7hkE
	sSfiRpjXCOdKVGuaeRH71wv3gi63oEERFQHBrwiB00BR8sTsL90tLqXk5MNOZtPgrA
	vsi/1GsVejW3Xh6Mq9FBaZdQv0KSFlPJhVIy11x0=
Received: by ti129.telemetry-investments.com (Postfix, from userid 300)
	id 0254C3B21; Mon, 29 Feb 2016 15:39:45 -0500 (EST)
Date: Mon, 29 Feb 2016 15:39:45 -0500
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
To: =?iso-8859-1?Q?J=FCrgen?= Kahrs <juergen.kahrs@googlemail.com>
Message-ID: <20160229203945.GA30054@ti129.telemetry-investments.com>
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
In-Reply-To: <56D48A2C.4040702@googlemail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 38.76.0.51
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 903
Lines: 23

On Mon, Feb 29, 2016 at 07:13:00PM +0100, J=FCrgen Kahrs wrote:
> Am 29.02.2016 um 06:29 schrieb Aharon Robbins:
> > Can you take a look at making this work again?  It's entirely possibl=
e
> > I messed something up when I moved to getaddrinfo.  I don't have tons
> > of cycles at the moment, so I could use some help on this.
>=20
> The internal data structures to be used with
> sockets today are very different from what we
> have learned by reading Richard Stevens' books.
> I will have a look at it next weekend.
> If I find a solution, then I will send you a patch.

If you are unable to solve it, it would at least be helpful to share some
specific examples with the expected and current (incorrect) behavior. Tha=
t
should make it much easier to troubleshoot and fix. I tried to strace the
process to see what's going on, but I'm not sure I was working on the rig=
ht
sample code.

Thanks,
Andy

From eliz@gnu.org Mon Feb 29 15:53:39 2016
Return-Path: <eliz@gnu.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
 ti9.telemetry-investments.com
X-Spam-Level: 
X-Spam-Status: No, score=-6.9 required=10.0 tests=BAYES_00,RCVD_IN_DNSWL_HI,
 RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RP_MATCHES_RCVD autolearn=ham
 autolearn_force=no version=3.4.0
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
 by ti129.telemetry-investments.com (Postfix) with ESMTP id 990F73DA
 for <schorr@schorr.telemetry-investments.com>;
 Mon, 29 Feb 2016 15:53:39 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
 id 8C7A36AA; Mon, 29 Feb 2016 15:53:39 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from eggs.gnu.org (eggs.gnu.org [208.118.235.92])
 by sv3.telemetry-investments.com (Postfix) with ESMTP id 4BB4C5A4
 for <aschorr@telemetry-investments.com>; Mon, 29 Feb 2016 15:53:38 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 4BB4C5A4
Authentication-Results: sv3.telemetry-investments.com;
 dmarc=none header.from=gnu.org
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@gnu.org>) id 1aaUoz-00022z-Pz
 for aschorr@telemetry-investments.com; Mon, 29 Feb 2016 15:53:38 -0500
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37766)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@gnu.org>)
 id 1aaUot-00022S-Rj; Mon, 29 Feb 2016 15:53:31 -0500
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1138
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
 (Exim 4.82) (envelope-from <eliz@gnu.org>)
 id 1aaUot-0003Id-4U; Mon, 29 Feb 2016 15:53:31 -0500
Date: Mon, 29 Feb 2016 22:53:19 +0200
Message-Id: <838u238chs.fsf@gnu.org>
From: Eli Zaretskii <eliz@gnu.org>
To: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
CC: juergen.kahrs@googlemail.com, gawk-devel@gnu.org
In-reply-to: <20160229203945.GA30054@ti129.telemetry-investments.com>
 (aschorr@telemetry-investments.com)
Subject: Re: [gawk-devel] UDP networking doesn't work?
Reply-to: Eli Zaretskii <eliz@gnu.org>
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
 <201602290529.u1T5Tk2m002991@skeeve.com>
 <56D48A2C.4040702@googlemail.com>
 <20160229203945.GA30054@ti129.telemetry-investments.com>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of eliz@gnu.org
 designates 208.118.235.92 as permitted sender)
 receiver=sv3.telemetry-investments.com; client-ip=208.118.235.92;
 envelope-from=<eliz@gnu.org>; helo=eggs.gnu.org;
X-Spambayes-Classification: ham; 0.00
Status: RO
X-Status: A
Content-Length: 913
Lines: 29

> Date: Mon, 29 Feb 2016 15:39:45 -0500
> From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
> Cc: gawk-devel@gnu.org
> 
> If you are unable to solve it, it would at least be helpful to share some
> specific examples with the expected and current (incorrect) behavior. That
> should make it much easier to troubleshoot and fix. I tried to strace the
> process to see what's going on, but I'm not sure I was working on the right
> sample code.

The sample code is from the manual:

     # Server
     BEGIN {
       print strftime() |& "/inet/udp/8888/0/0"
       close("/inet/udp/8888/0/0")
     }

     # Client
     BEGIN {
       "/inet/udp/0/localhost/8888" |& getline
       print $0
       close("/inet/udp/0/localhost/8888")
     }

Launch the client first, then the server.  The server exists
immediately (after seemingly have sent the data), while the client
hangs without receiving anything.


From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Mon Feb 29 16:05:16 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 9D10B3DA
	for <schorr@schorr.telemetry-investments.com>; Mon, 29 Feb 2016 16:05:16 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id 927846AA; Mon, 29 Feb 2016 16:05:16 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 60D965A4
	for <aschorr@telemetry-investments.com>; Mon, 29 Feb 2016 16:05:16 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 60D965A4
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=telemetry-investments.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=fail reason="key not found in DNS" (0-bit key) header.d=telemetry-investments.com header.i=@telemetry-investments.com header.b=AowHxOcX
Received: from localhost ([::1]:39152 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1aaV0F-0006WM-Rb
	for aschorr@telemetry-investments.com; Mon, 29 Feb 2016 16:05:15 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39030)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1aaV0C-0006U0-R2
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 16:05:13 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1aaV0C-000506-3B
	for gawk-devel@gnu.org; Mon, 29 Feb 2016 16:05:12 -0500
Received: from gw3a.telemetry-investments.com ([38.76.0.51]:55215
	helo=sv3.telemetry-investments.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1aaV06-0004xe-F8; Mon, 29 Feb 2016 16:05:06 -0500
Received: from ti129.telemetry-investments.com (ti129 [192.168.53.129])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id B37CE5A4;
	Mon, 29 Feb 2016 16:05:05 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=telemetry-investments.com; s=tele1409; t=1456779905;
	bh=Uo2h8QVk3LFkYRpl//RgEad2m5RrZBF16zjLTxQjP0A=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=AowHxOcXSdBCZ4JnIBjnmJPHCpMTk2aYdpTnoYy+P489X1yvtX78xeOql8+YjFf3i
	87Bp8MB9E6wFbyacy0SmKA2v1mF4sWvBR7e5zeIDrlJYKp9wsr+w4ohmexSa+AkwLV
	XJ7LkXV17v0xW+/k70x9mWWucVNRVkvUyDctjxL0=
Received: by ti129.telemetry-investments.com (Postfix, from userid 300)
	id 9647D3B21; Mon, 29 Feb 2016 16:05:05 -0500 (EST)
Date: Mon, 29 Feb 2016 16:05:05 -0500
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
To: Eli Zaretskii <eliz@gnu.org>
Message-ID: <20160229210505.GA30843@ti129.telemetry-investments.com>
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<838u238chs.fsf@gnu.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <838u238chs.fsf@gnu.org>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 38.76.0.51
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 1478
Lines: 45

On Mon, Feb 29, 2016 at 10:53:19PM +0200, Eli Zaretskii wrote:
> The sample code is from the manual:
> 
>      # Server
>      BEGIN {
>        print strftime() |& "/inet/udp/8888/0/0"
>        close("/inet/udp/8888/0/0")
>      }
> 
>      # Client
>      BEGIN {
>        "/inet/udp/0/localhost/8888" |& getline
>        print $0
>        close("/inet/udp/0/localhost/8888")
>      }
> 
> Launch the client first, then the server.  The server exists
> immediately (after seemingly have sent the data), while the client
> hangs without receiving anything.

Hmmm. When I run these on Linux using the gawk master branch,
they both hang. This is on Fedora 21.

According to strace, the client hangs reading this file descriptor:
   socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
   bind(3, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
   connect(3, {sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
   ...
   dup(3)                                  = 4
   ...
   read(4, 
That looks sensible.

And the server hangs here:
   socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
   bind(3, {sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
   recvfrom(3, 

I don't know why the server is binding that address and reading instead
of sending a packet to that address. Something is wrong.
And I also don't know why yours exits and mine hangs. Are you running
on Windows or Linux?

Regards,
Andy

From arnold@skeeve.com Sat Mar  5 23:10:12 2016
Return-Path: <arnold@skeeve.com>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
 ti9.telemetry-investments.com
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=10.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 
 RCVD_IN_MSPIKE_H3,
 RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
 by ti129.telemetry-investments.com (Postfix) with ESMTP id C7088269
 for <schorr@schorr.telemetry-investments.com>;
 Sat,  5 Mar 2016 23:10:12 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
 id B983E6CE; Sat,  5 Mar 2016 23:10:12 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from mxout1.netvision.net.il (mxout1.netvision.net.il [194.90.9.20])
 by sv3.telemetry-investments.com (Postfix) with ESMTP id 5A405343
 for <aschorr@telemetry-investments.com>; Sat,  5 Mar 2016 23:10:11 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 5A405343
Authentication-Results: sv3.telemetry-investments.com;
 dmarc=none header.from=skeeve.com
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; CHARSET=US-ASCII
Received: from skeeve.com ([93.173.253.111]) by mxout1.netvision.net.il
 (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov
 17 2011)) with ESMTPSA id <0O3L00GWRNH66C90@mxout1.netvision.net.il> for
 aschorr@telemetry-investments.com; Sun, 06 Mar 2016 06:07:54 +0200 (IST)
Received: from skeeve.com (skeeve.com [127.0.0.1])
 by skeeve.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id u2647rRg003778; 
 Sun, 06 Mar 2016 06:07:53 +0200
Received: (from arnold@localhost)	by skeeve.com (8.14.4/8.14.4/Submit)
 id u2647rk3003777; Sun, 06 Mar 2016 06:07:53 +0200
From: Aharon Robbins <arnold@skeeve.com>
Message-id: <201603060407.u2647rk3003777@skeeve.com>
Date: Sun, 06 Mar 2016 06:07:53 +0200
To: eliz@gnu.org, aschorr@telemetry-investments.com
Subject: Re: [gawk-devel] UDP networking doesn't work?
Cc: gawk-devel@gnu.org
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
 <201602290529.u1T5Tk2m002991@skeeve.com> <56D48A2C.4040702@googlemail.com>
 <20160229203945.GA30054@ti129.telemetry-investments.com>
 <838u238chs.fsf@gnu.org>
 <20160229210505.GA30843@ti129.telemetry-investments.com>
 <837fhm98r7.fsf@gnu.org>
In-reply-to: <837fhm98r7.fsf@gnu.org>
User-Agent: Heirloom mailx 12.5 6/20/10
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: None (sv3.telemetry-investments.com: domain of arnold@skeeve.com
 does not designate permitted sender hosts)
 receiver=sv3.telemetry-investments.com; client-ip=194.90.9.20;
 envelope-from=<arnold@skeeve.com>; helo=mxout1.netvision.net.il;
X-Spambayes-Classification: ham; 0.00
Status: RO
Content-Length: 296
Lines: 14

The UDP examples both hang for me, even when I go back as far as
gawk 3.1.0!

That's really strange.

Those are old binaries; I may try recompiling old code from source
to see what I get. I'm on Ubuntu 14.04.

If anyone can make progress on this before me, I'd appreciate it...

Thanks,

Arnold


From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar  6 09:57:54 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 35FFB3C5
	for <schorr@schorr.telemetry-investments.com>; Sun,  6 Mar 2016 09:57:54 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id 2645F6C5; Sun,  6 Mar 2016 09:57:54 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id AEB9E6A4
	for <aschorr@telemetry-investments.com>; Sun,  6 Mar 2016 09:57:53 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com AEB9E6A4
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=g0988vir
Received: from localhost ([::1]:50813 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1aca7z-00021q-OT
	for aschorr@telemetry-investments.com; Sun, 06 Mar 2016 09:57:51 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38843)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1aca7v-00021j-UG
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 09:57:49 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1aca7s-0000BS-Mh
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 09:57:47 -0500
Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:36907)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1aca7s-0000BH-AQ
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 09:57:44 -0500
Received: by mail-wm0-x22e.google.com with SMTP id p65so43504875wmp.0
	for <gawk-devel@gnu.org>; Sun, 06 Mar 2016 06:57:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:references:to:message-id:date:user-agent:mime-version
	:in-reply-to; bh=9LNHJzPXV84uMN+GtLUMey/Zm56fsLTTzkmpf1mbiGo=;
	b=g0988virz+G6qeClQyJXScghW5fzPf1P1M8glgOOnk9Qn0cd1ef4KVl8MwJN1glJW3
	fyuAPMmp63i2l7VVZu5Wsh/EXKSjG53O8TY3G0n5ZWC54WWD7Pl5KluKf4dWJU0JkyhQ
	gmsheRZcbhZCx3Ezt4dnzWRyCPeohKGERJIUrOfYn4YAkTeKb0L9cRtX1A95Il9lkC2G
	yYRQ+AcX84AVyW6tflDBzacoqo9oyvWrwzD9HFoGGklClqqpaR6yF6U1G/ml2ay/aGGc
	rIBjj71zJh4LP9ojebBszt0R5ZDFMFFIBl7h2L+GXdTBcZd+obCiKCNZjmSiUNX2gGub
	RqEQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:references:to:message-id:date
	:user-agent:mime-version:in-reply-to;
	bh=9LNHJzPXV84uMN+GtLUMey/Zm56fsLTTzkmpf1mbiGo=;
	b=axrCCQ/STqjKY3dOd6V4AcFS7DwsQBmOmnQXFUEprIZpgOUbiSRYcvlDb//4UjPDBb
	ZcxDYPISzEH+BoDIZ54X9D/Fjthxl4TOzrH45U0Ry3DkPE5CMiposhroHrNckxPzJi0M
	qfmJIqQcNR9F9620q8rAuCzSv3HYoszqNrEwjzKLdaj6guSmmhxliEiFCOPIA4rDNRM4
	GELqnfVy9Bdume8yiFsjOXZWvDB6olV6E8ZcRRWmu4lxGmWY9btI3Bpk/kRvgS6zPGc3
	rpfDSf7qG5uPX0oKZpYMRkL1HPb30eBSuoNV3sdKsi3XOICMKf7SE9a21p2kk8RbfXZY
	guZQ==
X-Gm-Message-State: AD7BkJLIist95OV59smCWVOoW0F6p9utFW58ikfOqKebR2EsRUPzInPaXj8mASrtVNKMpg==
X-Received: by 10.194.77.193 with SMTP id u1mr18205584wjw.73.1457276263317;
	Sun, 06 Mar 2016 06:57:43 -0800 (PST)
Received: from [192.168.0.11] (ip5f5ac802.dynamic.kabel-deutschland.de.
	[95.90.200.2]) by smtp.googlemail.com with ESMTPSA id
	h7sm221855wmf.9.2016.03.06.06.57.41 for <gawk-devel@gnu.org>
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 06 Mar 2016 06:57:42 -0800 (PST)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
To: gawk-devel@gnu.org
Message-ID: <56DC4565.9060302@googlemail.com>
Date: Sun, 6 Mar 2016 15:57:41 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <20160229203945.GA30054@ti129.telemetry-investments.com>
Content-Type: multipart/alternative;
	boundary="------------030801080701090502000108"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::22e
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 8592
Lines: 190

This is a multi-part message in MIME format.
--------------030801080701090502000108
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 8bit

Hello Andrew,

> On Mon, Feb 29, 2016 at 07:13:00PM +0100, Jürgen Kahrs wrote:
>> Am 29.02.2016 um 06:29 schrieb Aharon Robbins:
>>> Can you take a look at making this work again?  It's entirely possible
>>> I messed something up when I moved to getaddrinfo.  I don't have tons
>>> of cycles at the moment, so I could use some help on this.
>> The internal data structures to be used with
>> sockets today are very different from what we
>> have learned by reading Richard Stevens' books.
>> I will have a look at it next weekend.
>> If I find a solution, then I will send you a patch.
> If you are unable to solve it, it would at least be helpful to share some
> specific examples with the expected and current (incorrect) behavior. That
> should make it much easier to troubleshoot and fix.

Eli has already pointed you to the example source code.
The source code he mentions is indeed the example source
code as listed in the doc.

> I tried to strace the
> process to see what's going on, but I'm not sure I was working on the right
> sample code.

I have also used strace to find out what's going wrong.
It is essential to see the system calls involved.
The bug originates in the recvfrom call (line 1598) in io.c (socketopen).
One the server side do this:
  strace gawk -f server.awk
On the client side, do this (instead of using client.awk):
  echo moin | netcat -u localhost 8888

Now look at what strace tells us.

    socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
    bind(3, {sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
    recvfrom(3, "m", 1, MSG_PEEK, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\1\0\0\0\0\0\0\0"}, [16]) = 1
    connect(3, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\1\0\0\0\0\0\0\0"}, 16) = 0
    fcntl(3, F_GETFD)                       = 0
    fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
    fcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR)
    fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0217729000
    lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)

The address family as returned by recvfrom() is AF_UNSPEC,
instead of being AF_INET. The connect() call uses this wrong
address and things go even more wrongly. Even after reading
the man page, I haven't understood why we get AF_UNSPEC.
This behaviour may also depend on the configuration of the
network on your machine (IPv4 or IPv6 as default). From what
I understood, I would say that our problems is the same as
the one described here (in the "Answer" section):

http://stackoverflow.com/questions/18108797/recvfrom-not-receiving-depending-on-ai-family-used

If you want to see what should happen if everything is fine,
replace server.awk and client.awk by similar netcat usage:

  echo $( date ) | netcat -l -u 8888          # server
  echo moin | netcat -u localhost 8888    # client

strace with netcat will show system calls similar to what gawk does.
Hmm, this example shows a slight difference to the
client.awk that we use. The "echo moin" of the client is
necessary, but the client.awk does not do this.
This difference explains what Arnold observed in gawk
since 3.1.0.

So, the example UDP client code contains a hang.
But besides this hang problem there is a different problem
with the AF_UNSPEC.

--------------030801080701090502000108
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hello Andrew,<br>
      <br>
    </div>
    <blockquote
      cite="mid:20160229203945.GA30054@ti129.telemetry-investments.com"
      type="cite">
      <pre wrap="">On Mon, Feb 29, 2016 at 07:13:00PM +0100, Jürgen Kahrs wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">Am 29.02.2016 um 06:29 schrieb Aharon Robbins:
</pre>
        <blockquote type="cite">
          <pre wrap="">Can you take a look at making this work again?  It's entirely possible
I messed something up when I moved to getaddrinfo.  I don't have tons
of cycles at the moment, so I could use some help on this.
</pre>
        </blockquote>
        <pre wrap="">
The internal data structures to be used with
sockets today are very different from what we
have learned by reading Richard Stevens' books.
I will have a look at it next weekend.
If I find a solution, then I will send you a patch.
</pre>
      </blockquote>
      <pre wrap="">
If you are unable to solve it, it would at least be helpful to share some
specific examples with the expected and current (incorrect) behavior. That
should make it much easier to troubleshoot and fix.</pre>
    </blockquote>
    <br>
    Eli has already pointed you to the example source code.<br>
    The source code he mentions is indeed the example source<br>
    code as listed in the doc.<br>
    <br>
    <blockquote
      cite="mid:20160229203945.GA30054@ti129.telemetry-investments.com"
      type="cite">
      <pre wrap="">I tried to strace the
process to see what's going on, but I'm not sure I was working on the right
sample code.
</pre>
    </blockquote>
    <br>
    I have also used strace to find out what's going wrong.<br>
    It is essential to see the system calls involved.<br>
    The bug originates in the recvfrom call (line 1598) in io.c
    (socketopen).<br>
    One the server side do this:<br>
      <tt>strace gawk -f server.awk</tt><br>
    On the client side, do this (instead of using client.awk):<br>
      <tt>echo moin | netcat -u localhost 8888</tt><tt><br>
    </tt><br>
    Now look at what strace tells us.<br>
    <blockquote><tt>socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3</tt><tt><br>
      </tt><tt>bind(3, {sa_family=AF_INET, sin_port=htons(8888),
        sin_addr=inet_addr("0.0.0.0")}, 16) = 0</tt><tt><br>
      </tt><tt>recvfrom(3, "m", 1, MSG_PEEK, {<font color="#ff0000">sa_family=AF_UNSPEC</font>,
        sa_data="\0\0\0\0\0\0\1\0\0\0\0\0\0\0"}, [16]) = 1</tt><tt><br>
      </tt><tt>connect(3, {sa_family=AF_UNSPEC,
        sa_data="\0\0\0\0\0\0\1\0\0\0\0\0\0\0"}, 16) = 0</tt><tt><br>
      </tt><tt>fcntl(3, F_GETFD)                       = 0</tt><tt><br>
      </tt><tt>fcntl(3, F_SETFD, FD_CLOEXEC)           = 0</tt><tt><br>
      </tt><tt>fcntl(3, F_GETFL)                       = 0x2 (flags
        O_RDWR)</tt><tt><br>
      </tt><tt>fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0</tt><tt><br>
      </tt><tt>mmap(NULL, 4096, PROT_READ|PROT_WRITE,
        MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f0217729000</tt><tt><br>
      </tt><tt>lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE
        (Illegal seek)</tt><tt><br>
      </tt></blockquote>
    The address family as returned by recvfrom() is AF_UNSPEC,<br>
    instead of being AF_INET. The connect() call uses this wrong<br>
    address and things go even more wrongly. Even after reading<br>
    the man page, I haven't understood why we get AF_UNSPEC.<br>
    This behaviour may also depend on the configuration of the<br>
    network on your machine (IPv4 or IPv6 as default). From what<br>
    I understood, I would say that our problems is the same as<br>
    the one described here (in the "Answer" section):<br>
    <br>
<a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/18108797/recvfrom-not-receiving-depending-on-ai-family-used">http://stackoverflow.com/questions/18108797/recvfrom-not-receiving-depending-on-ai-family-used</a><br>
    <br>
    If you want to see what should happen if everything is fine,<br>
    replace server.awk and client.awk by similar netcat usage:<br>
    <br>
      echo $( date ) | netcat -l -u 8888          # server<br>
      echo moin | netcat -u localhost 8888    # client<br>
    <br>
    strace with netcat will show system calls similar to what gawk does.<br>
    Hmm, this example shows a slight difference to the<br>
    client.awk that we use. The "echo moin" of the client is<br>
    necessary, but the client.awk does not do this.<br>
    This difference explains what Arnold observed in gawk<br>
    since 3.1.0.<br>
    <br>
    So, the example UDP client code contains a hang.<br>
    But besides this hang problem there is a different problem<br>
    with the AF_UNSPEC.<br>
  </body>
</html>

--------------030801080701090502000108--

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar  6 13:29:16 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id B0A80442
	for <schorr@schorr.telemetry-investments.com>; Sun,  6 Mar 2016 13:29:16 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id A297E6C5; Sun,  6 Mar 2016 13:29:16 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 5E0984B
	for <aschorr@telemetry-investments.com>; Sun,  6 Mar 2016 13:29:15 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 5E0984B
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=gmail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MncCGERE
Received: from localhost ([::1]:51640 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1acdQW-0003XC-Mk
	for aschorr@telemetry-investments.com; Sun, 06 Mar 2016 13:29:12 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49085)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1acdQU-0003Ul-7m
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 13:29:11 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1acdQR-0000Pl-2v
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 13:29:10 -0500
Received: from mail-io0-x234.google.com ([2607:f8b0:4001:c06::234]:34471)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1acdQQ-0000PT-VO
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 13:29:07 -0500
Received: by mail-io0-x234.google.com with SMTP id m184so110570737iof.1
	for <gawk-devel@gnu.org>; Sun, 06 Mar 2016 10:29:06 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=date:from:to:cc:subject:message-id:references:mime-version
	:content-disposition:content-transfer-encoding:in-reply-to
	:user-agent; bh=u7hO1hxwFA3IHtw+0exna711t750EnHddhZynjQlii0=;
	b=MncCGEREhG+Cdhx4JWoTlNqLF23c/8heUayTFsDQneRsEHbU1HU7VNT+Hg58VVKnhq
	QgEzX8h43xHyZ60dsGOm7cwtzZzc6tybuSdRxSc6x5VatEQBEH7599m+VnNiUMEp/7Cj
	3/DRkNBnr72mTmAwG8HGx/4d5Gmjzt292Zo50fce05vRJZNChck6heYGjfHtpGIk4WM2
	LTpy6HsFIbrNpSFduZB44CVKbm7cYiL7AdivYtPUYqs0mmolMPuJWAnstbXLmvCJFA2d
	X3FPgUQ6Xv1ozJLpCFaCky1FaJky/3MYYL5Djzd1IpX8RLEnrldB6J2tgkpfWTlGTCtI
	QrjA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:date:from:to:cc:subject:message-id:references
	:mime-version:content-disposition:content-transfer-encoding
	:in-reply-to:user-agent;
	bh=u7hO1hxwFA3IHtw+0exna711t750EnHddhZynjQlii0=;
	b=RuDfu46uioIClB2uoxCa95feruKvQVo7HqOHUp3wIJh7k5QLqpolzI1saI8upJebWG
	tlV54x71KiheXq/ZxvzWXLHBYlcPpa1n/So+9S6QBnOOITasNLRJatnuN28lSEK1qi/d
	hgWx7cwRcQ95wsSUSVlRexGmXrXmoDnCC8ekMtBEmpDPmlPzeY9ePYtgBoiMYuIyDLUo
	tOLIXDisi4uK+vEM5szdh/E3Eu612ZETLeu6tkaq5WzN0OWhGsUspdTbVPr4QOwEwnqw
	h6PFNr/qnP8+kV0n8cS7ig78IkGn3C9Gu5Ax0MxyQe2SNqsAnCGJChyHfM9wOx58+01w
	didA==
X-Gm-Message-State: AD7BkJIs3KQWYHBJg3KoM+oD2tfif486wHqvqslqdnWLWxfyIUB/QZsRFy6uLkd5SodHJQ==
X-Received: by 10.107.3.34 with SMTP id 34mr8820297iod.159.1457288946214;
	Sun, 06 Mar 2016 10:29:06 -0800 (PST)
Received: from smok.internal (d23-17-121-177.abhsia.telus.net. [23.17.121.177])
	by smtp.gmail.com with ESMTPSA id l17sm3507503igf.1.2016.03.06.10.29.04
	(version=TLS1_2 cipher=AES128-SHA bits=128/128);
	Sun, 06 Mar 2016 10:29:05 -0800 (PST)
Date: Sun, 6 Mar 2016 11:28:57 -0700
From: Michal Jaegermann <michal.jnn@gmail.com>
To: =?iso-8859-1?Q?J=FCrgen?= Kahrs <juergen.kahrs@googlemail.com>
Message-ID: <20160306182857.GA27654@smok.internal>
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <56DC4565.9060302@googlemail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:4001:c06::234
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 779
Lines: 21

On Sun, Mar 06, 2016 at 03:57:41PM +0100, Jürgen Kahrs wrote:
> 
> The address family as returned by recvfrom() is AF_UNSPEC,
> instead of being AF_INET.

'man 3 getaddrinfo', at least on Linux,  says the following:

The value AF_UNSPEC indicates that getaddrinfo() should return socket
addresses  for any address family (either IPv4 or IPv6, for example) that can
be used with node and service.

> Even after reading
> the man page, I haven't understood why we get AF_UNSPEC.

Sockets may have IPv4 addresses, or IPv6, or both; so AF_UNSPEC
looks correct but it appears that handling that is somewhat more involved
(like in http://stackoverflow.com/questions/18108797 you are quoting).
It appears from the net search that the same trouble was bumped into
many times.

   Michal

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar  6 14:22:23 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 930433DCA
	for <schorr@schorr.telemetry-investments.com>; Sun,  6 Mar 2016 14:22:23 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id 7E1006EF; Sun,  6 Mar 2016 14:22:23 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 24A9E6A8
	for <aschorr@telemetry-investments.com>; Sun,  6 Mar 2016 14:22:22 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 24A9E6A8
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=skeeve.com
Received: from localhost ([::1]:51849 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1aceFv-0004nU-Hf
	for aschorr@telemetry-investments.com; Sun, 06 Mar 2016 14:22:19 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57734)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1aceFt-0004nF-KD
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 14:22:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1aceFq-0002NT-Pm
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 14:22:17 -0500
Received: from mxout1.netvision.net.il ([194.90.9.20]:64784)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1aceFq-0002NB-IA
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 14:22:14 -0500
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; CHARSET=US-ASCII
Received: from skeeve.com ([93.173.253.111]) by mxout1.netvision.net.il
	(Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit
	(built Nov
	17 2011)) with ESMTPSA id <0O3M00659TQ0PL60@mxout1.netvision.net.il>
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 21:20:25 +0200 (IST)
Received: from skeeve.com (skeeve.com [127.0.0.1])
	by skeeve.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id
	u26JKOwq007181; Sun, 06 Mar 2016 21:20:24 +0200
Received: (from arnold@localhost)	by skeeve.com (8.14.4/8.14.4/Submit)
	id u26JKO9h007180; Sun, 06 Mar 2016 21:20:24 +0200
From: Aharon Robbins <arnold@skeeve.com>
Message-id: <201603061920.u26JKO9h007180@skeeve.com>
Date: Sun, 06 Mar 2016 21:20:24 +0200
To: michal.jnn@gmail.com, juergen.kahrs@googlemail.com
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
In-reply-to: <20160306182857.GA27654@smok.internal>
User-Agent: Heirloom mailx 12.5 6/20/10
X-detected-operating-system: by eggs.gnu.org: Solaris 10
X-Received-From: 194.90.9.20
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 123
Lines: 6

I also tried using /inet4/... in the client and server, and it didn't
make any difference.  Any idea why?

Thanks,

Arnold

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar  6 15:03:23 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 079A1442
	for <schorr@schorr.telemetry-investments.com>; Sun,  6 Mar 2016 15:03:23 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id E72A36C5; Sun,  6 Mar 2016 15:03:22 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id A4AEE461
	for <aschorr@telemetry-investments.com>; Sun,  6 Mar 2016 15:03:22 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com A4AEE461
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=waSQHfxn
Received: from localhost ([::1]:51957 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1acetd-0004fb-9Z
	for aschorr@telemetry-investments.com; Sun, 06 Mar 2016 15:03:21 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34108)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1acetZ-0004ez-QZ
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 15:03:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1acetV-0000mg-QE
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 15:03:17 -0500
Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:35052)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1acetV-0000mb-Im
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 15:03:13 -0500
Received: by mail-wm0-x235.google.com with SMTP id l68so59078275wml.0
	for <gawk-devel@gnu.org>; Sun, 06 Mar 2016 12:03:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:to:references:message-id:date:user-agent:mime-version
	:in-reply-to:content-transfer-encoding;
	bh=1dhTPnLMl1NLYTiZ5B3/gUpJCZPbHFlYXmSyglJlsCQ=;
	b=waSQHfxn0Aeb/6+aCPqQvussc9woWxVJ8Z65zMSkD26kE/kc7QJjF0x1u4bi8xomN/
	RlnnIHzNC9k507ntNATNqsXt1RdukDOz0g6BbHECv8Vjrnjut1uDl88zmK2gKcOQ0Xal
	HqWqfjKX74wbvzN4a6i7c2ihTcjaMJcIen9TQlcswvelpMY+V8CqKnEgNdxLK2erLnN8
	rJuKMvXgsQrYrYfOhqi6Jz7OQEuVOv+39f5CBORYcq7S46+dzr656IUhdNoNueHB384/
	XN6qYNChVDBkxtQ9ThORTbzlte+NlQne5R2dGEM5Bt8F7btgnp4WX1eUlGtmWnhdlxLP
	AqBw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:to:references:message-id:date
	:user-agent:mime-version:in-reply-to:content-transfer-encoding;
	bh=1dhTPnLMl1NLYTiZ5B3/gUpJCZPbHFlYXmSyglJlsCQ=;
	b=MpG7lsWt4cPXQoQz8MyQ8utUvkfhsEYJuo6iI1fvs7pmBHf7MzuvuFJ7IACyHDz+gZ
	ZdWfB6d85ZrDd5zReycLdDA+CPrfvPnWhPYe+H+qkemXSYXz2eL03WSklEuRMQ5z/Q+x
	ZO74qKHurAmLIj8CpUmwkE6+xfJ9QI0lmlN2x5lfrHo2wIjwOD2qFqRnAXgkKufoS0ye
	+h2Yb4Swb4/7Q4fJpbXr/w4r3Ay1XCGw69+B3Yj/JQYqdfel+PkQo9WXcXi9HOKloDDr
	afPng3lSrHmzOl/MKivb+adGOQra5cYrPuWY+hETuL3g4fzLK0qHostNBRC+up6q+F5v
	zy+Q==
X-Gm-Message-State: AD7BkJL80YXtcXHPQ640xkfw+XIQdHyd1MjNpWmNBzKG/8WvUM8K14LHPSeiViXQprtdxg==
X-Received: by 10.194.6.234 with SMTP id e10mr19057923wja.118.1457294592575;
	Sun, 06 Mar 2016 12:03:12 -0800 (PST)
Received: from [192.168.0.11] (ip5f5ac802.dynamic.kabel-deutschland.de.
	[95.90.200.2]) by smtp.googlemail.com with ESMTPSA id
	73sm10167939wmy.22.2016.03.06.12.03.11 for <gawk-devel@gnu.org>
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 06 Mar 2016 12:03:12 -0800 (PST)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
To: gawk-devel@gnu.org
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061920.u26JKO9h007180@skeeve.com>
Message-ID: <56DC8CFF.8020501@googlemail.com>
Date: Sun, 6 Mar 2016 21:03:11 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <201603061920.u26JKO9h007180@skeeve.com>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::235
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 260
Lines: 7

Am 06.03.2016 um 20:20 schrieb Aharon Robbins:
> I also tried using /inet4/... in the client and server, and it didn't
> make any difference.  Any idea why?

I also played a bit with inet4 and it did not help.
It must be getaddrinfo() that returns AF_UNSPEC.


From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar  6 14:22:23 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 858FD426
	for <schorr@schorr.telemetry-investments.com>; Sun,  6 Mar 2016 14:22:23 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id 799F06CD; Sun,  6 Mar 2016 14:22:23 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 38A3C6C5
	for <aschorr@telemetry-investments.com>; Sun,  6 Mar 2016 14:22:22 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 38A3C6C5
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=skeeve.com
Received: from localhost ([::1]:51848 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1aceFv-0004nQ-GC
	for aschorr@telemetry-investments.com; Sun, 06 Mar 2016 14:22:19 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57735)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1aceFt-0004nG-K8
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 14:22:18 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1aceFq-0002NN-FK
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 14:22:17 -0500
Received: from mxout1.netvision.net.il ([194.90.9.20]:64784)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1aceFq-0002NB-7h
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 14:22:14 -0500
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; CHARSET=US-ASCII
Received: from skeeve.com ([93.173.253.111]) by mxout1.netvision.net.il
	(Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit
	(built Nov
	17 2011)) with ESMTPSA id <0O3M006QJTL0P750@mxout1.netvision.net.il>
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 21:17:25 +0200 (IST)
Received: from skeeve.com (skeeve.com [127.0.0.1])
	by skeeve.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id
	u26JHN0E006987; Sun, 06 Mar 2016 21:17:23 +0200
Received: (from arnold@localhost)	by skeeve.com (8.14.4/8.14.4/Submit)
	id u26JHNwQ006986; Sun, 06 Mar 2016 21:17:23 +0200
From: Aharon Robbins <arnold@skeeve.com>
Message-id: <201603061917.u26JHNwQ006986@skeeve.com>
Date: Sun, 06 Mar 2016 21:17:23 +0200
To: michal.jnn@gmail.com, juergen.kahrs@googlemail.com
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
In-reply-to: <20160306182857.GA27654@smok.internal>
User-Agent: Heirloom mailx 12.5 6/20/10
X-detected-operating-system: by eggs.gnu.org: Solaris 10
X-Received-From: 194.90.9.20
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 193
Lines: 9

Can anyone get the original code to work? I tried compiling 3.1.0
and I get the same hangs.

I don't mind trying to fix the logic, but I need to know what the
right steps are.

Thanks,

Arnold

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar  6 14:54:48 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 70D2F442
	for <schorr@schorr.telemetry-investments.com>; Sun,  6 Mar 2016 14:54:48 -0500 (EST)
Received: by sv3.telemetry-investments.com (Postfix)
	id 5EB176C5; Sun,  6 Mar 2016 14:54:48 -0500 (EST)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 1AA94461
	for <aschorr@telemetry-investments.com>; Sun,  6 Mar 2016 14:54:47 -0500 (EST)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 1AA94461
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=zcso3Y88
Received: from localhost ([::1]:51926 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1acelK-00027b-Aw
	for aschorr@telemetry-investments.com; Sun, 06 Mar 2016 14:54:46 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:32960)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1acelH-00027S-HQ
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 14:54:44 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1acelC-0007XY-UN
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 14:54:43 -0500
Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]:34190)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1acelC-0007XU-JZ
	for gawk-devel@gnu.org; Sun, 06 Mar 2016 14:54:38 -0500
Received: by mail-wm0-x22a.google.com with SMTP id p65so83441359wmp.1
	for <gawk-devel@gnu.org>; Sun, 06 Mar 2016 11:54:38 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:references:to:message-id:date:user-agent:mime-version
	:in-reply-to; bh=jpN7MlA2J8WKgCBtEd0/SINODoMoXu4ex9MgN7ulKUY=;
	b=zcso3Y88tDMyady9rMHk3stN+rwENwtdK/+VdolRUaUQtkbg0K5M/UcHzeRGydBToM
	bHALlRA1z0KzCcl6PQ7gww7S0ACEqzcK9YJU6l0EYD2B/yRxdgP7MMk016x+JMWKHhc9
	y9zPKARj9U0Cd+miCR7q7g/rX8P4SQP8Ynx/J1Edf77Et5SPTGRbmIDdymtcf4fqv/rW
	QCoB/3trZuX0nDtXF5Np7EfvJQN+ggE5ajtZYUZyRfLNH1OSC32TWLpRjolfxPiwi5XR
	/5MEjBrytpxW7tCo/XiGUMFVXlVR0m2RUE3LugkwQ/f4nVNwzfrMQiZHR4huh55TIqSC
	mdBA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:references:to:message-id:date
	:user-agent:mime-version:in-reply-to;
	bh=jpN7MlA2J8WKgCBtEd0/SINODoMoXu4ex9MgN7ulKUY=;
	b=k1KJcn+zjpYBUTvJdaYRmiZfrky7aCvHDe5IW4v2jNvpSAgJ/RtZo+o211GIV9vr/x
	lwZkfihSpbdA5ZBU1SIga0P9/cz/TTtYx5d7vON+3t/RdavgFmKiH47aUcxFb84MTnDh
	brDPOi5t6YWeZ2+QwgCTohkp47El7WeNGMyD+HQnY4jbpA5K3tyNTuKhIRQA2a11GZJJ
	5Ai5JYolH0/wKvYeKV4VKEBG2VvetDcLCLTpEInVODmGXAFicQU/FLGCRK0oPDeZtZSX
	2v2WQrcL2WkriElF+RxNKouq3lHc0vfn6nKBAxvl05hV/1PT8Foe7stT+IsUp31zNebT
	YcTQ==
X-Gm-Message-State: AD7BkJIs3yCk7zUgF2tESIDoQmgeve5dy71E5VdiTQ24MMQiRn76ydMgpIvVjhrEhzOIXw==
X-Received: by 10.28.125.195 with SMTP id y186mr4027672wmc.79.1457294077813;
	Sun, 06 Mar 2016 11:54:37 -0800 (PST)
Received: from [192.168.0.11] (ip5f5ac802.dynamic.kabel-deutschland.de.
	[95.90.200.2]) by smtp.googlemail.com with ESMTPSA id
	c71sm114480wmd.4.2016.03.06.11.54.36 for <gawk-devel@gnu.org>
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 06 Mar 2016 11:54:37 -0800 (PST)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
To: gawk-devel@gnu.org
Message-ID: <56DC8AFB.80708@googlemail.com>
Date: Sun, 6 Mar 2016 20:54:35 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <201603061917.u26JHNwQ006986@skeeve.com>
Content-Type: multipart/alternative;
	boundary="------------000000090503030309040109"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::22a
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 5130
Lines: 128

This is a multi-part message in MIME format.
--------------000000090503030309040109
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit

Am 06.03.2016 um 20:17 schrieb Aharon Robbins:
> Can anyone get the original code to work? I tried compiling 3.1.0
> and I get the same hangs.

I tried http://ftp.gnu.org/gnu/gawk/gawk-3.1.0.tar.gz
but couldnt build because the "configure" script hangs
in check of mktime.

I tried http://ftp.gnu.org/gnu/gawk/gawk-3.1.8.tar.gz
and it built.

The behaviour of the server example is similar (hangs)
but there is a slight difference:

    socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
    bind(3, {sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
    recvfrom(3, "m", 1, MSG_PEEK, {sa_family=AF_INET, sin_port=htons(57669), sin_addr=inet_addr("127.0.0.1")}, [16]) = 1
    connect(3, {sa_family=AF_INET, sin_port=htons(57669), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
    fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
    fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
    fcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR)


So the problem with the AF_UNSPEC did not appear
in gawk 3.1.8. The server script can send its string
to a client (I used the netcat client). The client did
receive the string. But the server script was unable
to terminate properly.

    fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd1d4190000
    lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)

This illegal seek also appears when gawk is built from
the current master.


> I don't mind trying to fix the logic, but I need to know what the
> right steps are.

It looks like 3 bugs:
1. Handling of AF_UNSPEC (correct in 3.1.8, wrong in master)
2. illegal seek (appears in both)
3. client script behaviour wrong in both



--------------000000090503030309040109
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Am 06.03.2016 um 20:17 schrieb Aharon
      Robbins:<br>
    </div>
    <blockquote cite="mid:201603061917.u26JHNwQ006986@skeeve.com"
      type="cite">
      <pre wrap="">Can anyone get the original code to work? I tried compiling 3.1.0
and I get the same hangs.</pre>
    </blockquote>
    <br>
    I tried <a class="moz-txt-link-freetext" href="http://ftp.gnu.org/gnu/gawk/gawk-3.1.0.tar.gz">http://ftp.gnu.org/gnu/gawk/gawk-3.1.0.tar.gz</a><br>
    but couldnt build because the "configure" script hangs<br>
    in check of mktime.<br>
    <br>
    I tried <a class="moz-txt-link-freetext" href="http://ftp.gnu.org/gnu/gawk/gawk-3.1.8.tar.gz">http://ftp.gnu.org/gnu/gawk/gawk-3.1.8.tar.gz</a><br>
    and it built.<br>
    <br>
    The behaviour of the server example is similar (hangs)<br>
    but there is a slight difference:<br>
    <br>
    <blockquote><tt>socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3</tt><tt><br>
      </tt><tt>bind(3, {sa_family=AF_INET, sin_port=htons(8888),
        sin_addr=inet_addr("0.0.0.0")}, 16) = 0</tt><tt><br>
      </tt><tt>recvfrom(3, "m", 1, MSG_PEEK, {<font color="#ff0000">sa_family=AF_INET</font>,
        sin_port=htons(57669), sin_addr=inet_addr("127.0.0.1")}, [16]) =
        1</tt><tt><br>
      </tt><tt>connect(3, {sa_family=AF_INET, sin_port=htons(57669),
        sin_addr=inet_addr("127.0.0.1")}, 16) = 0</tt><tt><br>
      </tt><tt>fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0</tt><tt><br>
      </tt><tt>fcntl(3, F_SETFD, FD_CLOEXEC)           = 0</tt><tt><br>
      </tt><tt>fcntl(3, F_GETFL)                       = 0x2 (flags
        O_RDWR)</tt><tt><br>
      </tt></blockquote>
    <br>
    So the problem with the AF_UNSPEC did not appear<br>
    in gawk 3.1.8. The server script can send its string<br>
    to a client (I used the netcat client). The client did<br>
    receive the string. But the server script was unable<br>
    to terminate properly.<br>
    <blockquote><tt>fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) =
        0</tt><tt><br>
      </tt><tt>mmap(NULL, 4096, PROT_READ|PROT_WRITE,
        MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd1d4190000</tt><tt><br>
      </tt><tt>lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (<font
          color="#ff0000">Illegal seek</font>)</tt><tt><br>
      </tt></blockquote>
    This illegal seek also appears when gawk is built from<br>
    the current master.<br>
    <br>
    <br>
    <blockquote cite="mid:201603061917.u26JHNwQ006986@skeeve.com"
      type="cite">
      <pre wrap="">I don't mind trying to fix the logic, but I need to know what the
right steps are.
</pre>
    </blockquote>
    <br>
    It looks like 3 bugs:<br>
    1. Handling of AF_UNSPEC (correct in 3.1.8, wrong in master)<br>
    2. illegal seek (appears in both)<br>
    3. client script behaviour wrong in both<br>
    <br>
    <br>
  </body>
</html>

--------------000000090503030309040109--

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 13 10:28:36 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id D97D1311
	for <schorr@schorr.telemetry-investments.com>; Sun, 13 Mar 2016 10:28:36 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id CC0BB6B1; Sun, 13 Mar 2016 10:28:36 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 70FE7598
	for <aschorr@telemetry-investments.com>; Sun, 13 Mar 2016 10:28:36 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 70FE7598
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=sa5CGyXS
Received: from localhost ([::1]:36235 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1af70U-0002U7-9W
	for aschorr@telemetry-investments.com; Sun, 13 Mar 2016 10:28:34 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34746)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1af70R-0002Tv-HI
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 10:28:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1af70M-0006uN-Sf
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 10:28:31 -0400
Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:37005)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1af70M-0006u8-HP
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 10:28:26 -0400
Received: by mail-wm0-x229.google.com with SMTP id p65so72040532wmp.0
	for <gawk-devel@gnu.org>; Sun, 13 Mar 2016 07:28:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:to:references:message-id:date:user-agent:mime-version
	:in-reply-to; bh=Mp1jzavGOjR15owakdQhLm0d9FnPYEbkWWB91yOS6E8=;
	b=sa5CGyXSYND4iUdbXcvZcDy1vPIQv+GzxlVIX6X02eq+Mhe4NHEycUyprkpCDT6jTi
	adz3vnM0hP4UH+k3ZUdHoDcSS2ob4HOGTfA9LQmAHV7m0lLRZxYjWbu2ufi/OQyhDhDH
	Nub30ogM6ek6S9VQgUwXVAR3PMyDKpntIfqpncHiAgA80FE9XgFdo8HMaMkJcUcydIfs
	0ED5NZmhudhU9DTx7VPrtUu1BXXFjoSr1BiZYn81/atQ1k+PjIenRqKwpCxVYAw85uYC
	IKTz38sCM/q6hUvqkLyOLa9MZy8ngVKVVxoSpRDHF7d9xnq/CGZlGiUWSUtCJRU8U/yA
	ortg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:to:references:message-id:date
	:user-agent:mime-version:in-reply-to;
	bh=Mp1jzavGOjR15owakdQhLm0d9FnPYEbkWWB91yOS6E8=;
	b=klAX1y/tXBvy+VHTPK44TdnTBYdoi4ZMrhjETzGAGP7p5/bCiKZAm/nXtHSRPyUcJD
	9CYz9ZgbwxWMDDyZ/tnb6S5qekAAbpZ8nqNLvmAdk++rFem1mPVK1CXW0jwNcx5PnFSj
	HKOJrxYEj9fjLKbQefhv63DAthTb0s+K/xnVKYzHjLCHYDTtH3DjDA/YqbLXgxZvK6bd
	pnU1yKwhC1MdAsKjxeJYvJxR3tB8v2p6Su3D+lhl7gp+Zr3nH5d8zZpXQQ+p+fxXRjrd
	2j2w9M+jCKO0zcErKbIWi87aTh0E4XqW8bLvRriFuzfk3Ir01486pg33djhNWkmHA07d
	5uDA==
X-Gm-Message-State: AD7BkJI+d/7J4mUjuSXimhVoI7r5BQK5z362MAZyr1EqDZnjK7ekJ6opBOh+4ZGwzRn8Zw==
X-Received: by 10.28.68.136 with SMTP id r130mr7983385wma.28.1457879304432;
	Sun, 13 Mar 2016 07:28:24 -0700 (PDT)
Received: from [192.168.0.11] (ip5f5ac869.dynamic.kabel-deutschland.de.
	[95.90.200.105]) by smtp.googlemail.com with ESMTPSA id
	d2sm17891811wjf.28.2016.03.13.07.28.23 for <gawk-devel@gnu.org>
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 13 Mar 2016 07:28:23 -0700 (PDT)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
To: gawk-devel@gnu.org
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com>
Message-ID: <56E57906.2030102@googlemail.com>
Date: Sun, 13 Mar 2016 15:28:22 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <56DC8AFB.80708@googlemail.com>
Content-Type: multipart/alternative;
	boundary="------------010903030700010703010304"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::229
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 7941
Lines: 189

This is a multi-part message in MIME format.
--------------010903030700010703010304
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 8bit

Am 06.03.2016 um 20:54 schrieb Jürgen Kahrs:
> Am 06.03.2016 um 20:17 schrieb Aharon Robbins:
>> Can anyone get the original code to work? I tried compiling 3.1.0
>> and I get the same hangs.
>
> I tried http://ftp.gnu.org/gnu/gawk/gawk-3.1.0.tar.gz
> but couldnt build because the "configure" script hangs
> in check of mktime.
>
> I tried http://ftp.gnu.org/gnu/gawk/gawk-3.1.8.tar.gz
> and it built.
>
> The behaviour of the server example is similar (hangs)
> but there is a slight difference:
>
>     socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3
>     bind(3, {sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
>     recvfrom(3, "m", 1, MSG_PEEK, {sa_family=AF_INET, sin_port=htons(57669), sin_addr=inet_addr("127.0.0.1")}, [16]) = 1
>     connect(3, {sa_family=AF_INET, sin_port=htons(57669), sin_addr=inet_addr("127.0.0.1")}, 16) = 0
>     fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
>     fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
>     fcntl(3, F_GETFL)                       = 0x2 (flags O_RDWR)
>
>
> So the problem with the AF_UNSPEC did not appear
> in gawk 3.1.8. The server script can send its string
> to a client (I used the netcat client). The client did
> receive the string. But the server script was unable
> to terminate properly.

I have found a way to change the behaviour of the  GAWK master
source code so that it behaves again in the same (correct) way as
described above for GAWK 3.1.8:

    --- a/io.c
    +++ b/io.c
    @@ -1593,7 +1593,7 @@ socketopen(int family, int type, const char *localpname,
     #ifdef MSG_PEEK
                                            char buf[10];
                                            struct sockaddr_storage remote_addr;
    -                                       socklen_t read_len = 0;
    +                                       socklen_t read_len = sizeof remote_addr;


recvfrom() was unable to pass the remote address only
because read_len was 0. It was a bit frustrating that such
a detail was silently ignored in the past and causes problems
in the more recent OS installations.

The other 2 problems that I listed below are still open.

>     fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
>     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd1d4190000
>     lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
>
> This illegal seek also appears when gawk is built from
> the current master.
>
>
>> I don't mind trying to fix the logic, but I need to know what the
>> right steps are.
>
> It looks like 3 bugs:
> 1. Handling of AF_UNSPEC (correct in 3.1.8, wrong in master)
> 2. illegal seek (appears in both)
> 3. client script behaviour wrong in both
>
>


--------------010903030700010703010304
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Am 06.03.2016 um 20:54 schrieb Jürgen
      Kahrs:<br>
    </div>
    <blockquote cite="mid:56DC8AFB.80708@googlemail.com" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">Am 06.03.2016 um 20:17 schrieb Aharon
        Robbins:<br>
      </div>
      <blockquote cite="mid:201603061917.u26JHNwQ006986@skeeve.com"
        type="cite">
        <pre wrap="">Can anyone get the original code to work? I tried compiling 3.1.0
and I get the same hangs.</pre>
      </blockquote>
      <br>
      I tried <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="http://ftp.gnu.org/gnu/gawk/gawk-3.1.0.tar.gz">http://ftp.gnu.org/gnu/gawk/gawk-3.1.0.tar.gz</a><br>
      but couldnt build because the "configure" script hangs<br>
      in check of mktime.<br>
      <br>
      I tried <a moz-do-not-send="true" class="moz-txt-link-freetext"
        href="http://ftp.gnu.org/gnu/gawk/gawk-3.1.8.tar.gz">http://ftp.gnu.org/gnu/gawk/gawk-3.1.8.tar.gz</a><br>
      and it built.<br>
      <br>
      The behaviour of the server example is similar (hangs)<br>
      but there is a slight difference:<br>
      <br>
      <blockquote><tt>socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3</tt><tt><br>
        </tt><tt>bind(3, {sa_family=AF_INET, sin_port=htons(8888),
          sin_addr=inet_addr("0.0.0.0")}, 16) = 0</tt><tt><br>
        </tt><tt>recvfrom(3, "m", 1, MSG_PEEK, {<font color="#ff0000">sa_family=AF_INET</font>,
          sin_port=htons(57669), sin_addr=inet_addr("127.0.0.1")}, [16])
          = 1</tt><tt><br>
        </tt><tt>connect(3, {sa_family=AF_INET, sin_port=htons(57669),
          sin_addr=inet_addr("127.0.0.1")}, 16) = 0</tt><tt><br>
        </tt><tt>fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0</tt><tt><br>
        </tt><tt>fcntl(3, F_SETFD, FD_CLOEXEC)           = 0</tt><tt><br>
        </tt><tt>fcntl(3, F_GETFL)                       = 0x2 (flags
          O_RDWR)</tt><tt><br>
        </tt></blockquote>
      <br>
      So the problem with the AF_UNSPEC did not appear<br>
      in gawk 3.1.8. The server script can send its string<br>
      to a client (I used the netcat client). The client did<br>
      receive the string. But the server script was unable<br>
      to terminate properly.<br>
    </blockquote>
    <br>
    I have found a way to change the behaviour of the  GAWK master<br>
    source code so that it behaves again in the same (correct) way as<br>
    described above for GAWK 3.1.8:<br>
    <br>
    <blockquote><tt>--- a/io.c</tt><tt><br>
      </tt><tt>+++ b/io.c</tt><tt><br>
      </tt><tt>@@ -1593,7 +1593,7 @@ socketopen(int family, int type,
        const char *localpname,</tt><tt><br>
      </tt><tt> #ifdef MSG_PEEK</tt><tt><br>
      </tt><tt>                                        char buf[10];</tt><tt><br>
      </tt><tt>                                        struct
        sockaddr_storage remote_addr;</tt><tt><br>
      </tt><tt>-                                       socklen_t
        read_len = <font color="#ff0000">0</font>;</tt><tt><br>
      </tt><tt>+                                       socklen_t
        read_len = <font color="#33ff33">sizeof remote_addr</font>;</tt><tt><br>
      </tt></blockquote>
    <br>
    recvfrom() was unable to pass the remote address only<br>
    because read_len was 0. It was a bit frustrating that such<br>
    a detail was silently ignored in the past and causes problems<br>
    in the more recent OS installations.<br>
    <br>
    The other 2 problems that I listed below are still open.<br>
    <br>
    <blockquote cite="mid:56DC8AFB.80708@googlemail.com" type="cite">
      <blockquote><tt>fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...})
          = 0</tt><tt><br>
        </tt><tt>mmap(NULL, 4096, PROT_READ|PROT_WRITE,
          MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd1d4190000</tt><tt><br>
        </tt><tt>lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (<font
            color="#ff0000">Illegal seek</font>)</tt><tt><br>
        </tt></blockquote>
      This illegal seek also appears when gawk is built from<br>
      the current master.<br>
      <br>
      <br>
      <blockquote cite="mid:201603061917.u26JHNwQ006986@skeeve.com"
        type="cite">
        <pre wrap="">I don't mind trying to fix the logic, but I need to know what the
right steps are.
</pre>
      </blockquote>
      <br>
      It looks like 3 bugs:<br>
      1. Handling of AF_UNSPEC (correct in 3.1.8, wrong in master)<br>
      2. illegal seek (appears in both)<br>
      3. client script behaviour wrong in both<br>
      <br>
      <br>
    </blockquote>
    <br>
  </body>
</html>

--------------010903030700010703010304--

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 13 12:15:25 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 55EBB311
	for <schorr@schorr.telemetry-investments.com>; Sun, 13 Mar 2016 12:15:25 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 4CEA16B1; Sun, 13 Mar 2016 12:15:25 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id E61BC5A6
	for <aschorr@telemetry-investments.com>; Sun, 13 Mar 2016 12:15:24 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com E61BC5A6
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=nWZaeqES
Received: from localhost ([::1]:36700 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1af8fq-0003kR-Ba
	for aschorr@telemetry-investments.com; Sun, 13 Mar 2016 12:15:22 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:53939)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1af8fn-0003kL-M9
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 12:15:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1af8fk-0006Bg-FM
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 12:15:19 -0400
Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:37423)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1af8fk-0006BY-4H
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 12:15:16 -0400
Received: by mail-wm0-x232.google.com with SMTP id p65so73858059wmp.0
	for <gawk-devel@gnu.org>; Sun, 13 Mar 2016 09:15:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:to:references:message-id:date:user-agent:mime-version
	:in-reply-to; bh=cI8tjWDQ/HDB9ajijBueVDNr0tDm1RHPIWYRjJDlMac=;
	b=nWZaeqESMIvwct2+WdyV6tnOiCGg0RReMzx3qiE7twqQg8isNnUPtLtHGzXEVGLBWi
	EefMRvL/F1n/eFXFFAgpzZlt9DJsvmgwQULNxHtf9Ke6sI4ixQHMD4BLxUyKcrKX6BA7
	oNw78tMUnxCSDfdu9f1bbxn6c/4KcBzzBdd1hZEMCk1FFP5prMMQjIjnYWMaXAC/mu7+
	aWokaSffVmAYQCvgAM244Ny1B7Bcc0SNISX6qTNeg/se0b7+fvlbRq1oGbaueTkELg7u
	mFpobz0y2Add3KbWyHgeUTZIZiXkm227LbCoNYJiGxY6/PIW3fziUMEU9hH+AhlWE8Ow
	knlw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:to:references:message-id:date
	:user-agent:mime-version:in-reply-to;
	bh=cI8tjWDQ/HDB9ajijBueVDNr0tDm1RHPIWYRjJDlMac=;
	b=WPjytpY9VH9K8raInLQsaJudA5UPMFuwNshHE0R7qDuO6/q0Ty6zf0dGqwkqGkEgSR
	cZ6aWQxflRqQkB+EXJTSFkeZG3FCDDavDC8AhPwWWKxX20O+63E7PanW4snxN5QVMvdq
	bkKILhuRbj0Rp6Hf/Xzyx9HIg8juEOJbnebzxqchxPAbgKdOiuIOlVN29labxaC7VbnM
	DVvymfMea6eWhDrMLtjBcbixxRmF42NJKmJ+LrGx7b+EE6i64F90CE4dVMp4LjDqHVhI
	YB5+TAcrC2WTuhypi4+cMa1YLdUilpQkIErh4gmSItSmqsp72Sg8cmVL4hzJm2/h0XSm
	kgTA==
X-Gm-Message-State: AD7BkJKDYKA52+Z/FmSx7C1XTym1Rw9UZ3roh0/SO8Q5B8j5KP2/4zcaFL2NFfeEffLkBw==
X-Received: by 10.28.178.209 with SMTP id b200mr13351098wmf.98.1457885715294; 
	Sun, 13 Mar 2016 09:15:15 -0700 (PDT)
Received: from [192.168.0.11] (ip5f5ac869.dynamic.kabel-deutschland.de.
	[95.90.200.105]) by smtp.googlemail.com with ESMTPSA id
	hh8sm18186673wjc.42.2016.03.13.09.15.14 for <gawk-devel@gnu.org>
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 13 Mar 2016 09:15:14 -0700 (PDT)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
To: gawk-devel@gnu.org
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com>
Message-ID: <56E5920F.2090204@googlemail.com>
Date: Sun, 13 Mar 2016 17:15:11 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <56DC8AFB.80708@googlemail.com>
Content-Type: multipart/alternative;
	boundary="------------030404060803030609050400"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::232
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 4374
Lines: 135

This is a multi-part message in MIME format.
--------------030404060803030609050400
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 8bit

Am 06.03.2016 um 20:54 schrieb Jürgen Kahrs:
>
>     fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
>     mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd1d4190000
>     lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
>
> This illegal seek also appears when gawk is built from
> the current master.

The illegal seek seems to cause no damage.
It happens in io.c two_way_open:

    rp->output.fp = fdopen(fd, binmode("wb"));

Is it necessary and worth the effort to avoid
the illegal seek ? I don't know.

>
>
>> I don't mind trying to fix the logic, but I need to know what the
>> right steps are.
>
> It looks like 3 bugs:
> 1. Handling of AF_UNSPEC (correct in 3.1.8, wrong in master)

Solved, see previous posting.

> 2. illegal seek (appears in both)

Can probably be ignored.

> 3. client script behaviour wrong in both

A modification of the UDP client solves this problem:

    # Client
    BEGIN {
      print "moin" |& "/inet/udp/0/localhost/8888"
      "/inet/udp/0/localhost/8888" |& getline
      print $0
      close("/inet/udp/0/localhost/8888")
    }


The difference is in the very first print command.
I am not really happy with this behaviour (because
it is different from the equivalent TCP client) but it
works.


--------------030404060803030609050400
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Am 06.03.2016 um 20:54 schrieb Jürgen
      Kahrs:<br>
    </div>
    <blockquote cite="mid:56DC8AFB.80708@googlemail.com" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <br>
      <blockquote><tt>fstat(3, {st_mode=S_IFSOCK|0777, st_size=0, ...})
          = 0</tt><tt><br>
        </tt><tt>mmap(NULL, 4096, PROT_READ|PROT_WRITE,
          MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd1d4190000</tt><tt><br>
        </tt><tt>lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (<font
            color="#ff0000">Illegal seek</font>)</tt><tt><br>
        </tt></blockquote>
      This illegal seek also appears when gawk is built from<br>
      the current master.<br>
    </blockquote>
    <br>
    The illegal seek seems to cause no damage.<br>
    It happens in io.c two_way_open: <br>
    <br>
    <blockquote><tt>rp-&gt;output.fp = fdopen(fd, binmode("wb"));</tt><tt><br>
      </tt></blockquote>
    Is it necessary and worth the effort to avoid<br>
    the illegal seek ? I don't know.<br>
    <br>
    <blockquote cite="mid:56DC8AFB.80708@googlemail.com" type="cite"> <br>
      <br>
      <blockquote cite="mid:201603061917.u26JHNwQ006986@skeeve.com"
        type="cite">
        <pre wrap="">I don't mind trying to fix the logic, but I need to know what the
right steps are.
</pre>
      </blockquote>
      <br>
      It looks like 3 bugs:<br>
      1. Handling of AF_UNSPEC (correct in 3.1.8, wrong in master)<br>
    </blockquote>
    <br>
    Solved, see previous posting.<br>
    <br>
    <blockquote cite="mid:56DC8AFB.80708@googlemail.com" type="cite"> 2.
      illegal seek (appears in both)<br>
    </blockquote>
    <br>
    Can probably be ignored.<br>
    <br>
    <blockquote cite="mid:56DC8AFB.80708@googlemail.com" type="cite"> 3.
      client script behaviour wrong in both<br>
    </blockquote>
    <br>
    A modification of the UDP client solves this problem:<br>
    <blockquote><tt># Client</tt><tt><br>
      </tt><tt>BEGIN {</tt><tt><br>
      </tt><tt>  print "moin" |&amp; "/inet/udp/0/localhost/8888"</tt><tt><br>
      </tt><tt>  "/inet/udp/0/localhost/8888" |&amp; getline</tt><tt><br>
      </tt><tt>  print $0</tt><tt><br>
      </tt><tt>  close("/inet/udp/0/localhost/8888")</tt><tt><br>
      </tt><tt>}</tt><tt><br>
      </tt></blockquote>
    <br>
    The difference is in the very first print command.<br>
    I am not really happy with this behaviour (because<br>
    it is different from the equivalent TCP client) but it<br>
    works.<br>
    <br>
  </body>
</html>

--------------030404060803030609050400--

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 13 13:19:20 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 0C6B4410
	for <schorr@schorr.telemetry-investments.com>; Sun, 13 Mar 2016 13:19:20 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id EDBDC6AB; Sun, 13 Mar 2016 13:19:19 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 9A42C4B
	for <aschorr@telemetry-investments.com>; Sun, 13 Mar 2016 13:19:19 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 9A42C4B
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=gnu.org
Received: from localhost ([::1]:36889 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1af9fh-0001wk-6u
	for aschorr@telemetry-investments.com; Sun, 13 Mar 2016 13:19:17 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37177)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eliz@gnu.org>) id 1af9ff-0001wb-Ek
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 13:19:16 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eliz@gnu.org>) id 1af9fc-00045s-8L
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 13:19:15 -0400
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41784)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@gnu.org>)
	id 1af9fc-00045o-58; Sun, 13 Mar 2016 13:19:12 -0400
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4566
	helo=home-c4e4a596f7)
	by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128)
	(Exim 4.82) (envelope-from <eliz@gnu.org>)
	id 1af9fb-0007Zs-9E; Sun, 13 Mar 2016 13:19:11 -0400
Date: Sun, 13 Mar 2016 19:18:42 +0200
Message-Id: <8337rufg99.fsf@gnu.org>
From: Eli Zaretskii <eliz@gnu.org>
To: =?windows-1252?Q?J=FCrgen_Kahrs?= <juergen.kahrs@googlemail.com>
In-reply-to: <56E5920F.2090204@googlemail.com> (juergen.kahrs@googlemail.com)
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
MIME-version: 1.0
Content-type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: Eli Zaretskii <eliz@gnu.org>
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 640
Lines: 27

> From: "Jürgen Kahrs" <juergen.kahrs@googlemail.com>
> Date: Sun, 13 Mar 2016 17:15:11 +0100
> 
>  3. client script behaviour wrong in both
> 
> 
> A modification of the UDP client solves this problem:
> 
> 
>  # Client
>  BEGIN {
>  print "moin" |& "/inet/udp/0/localhost/8888"
>  "/inet/udp/0/localhost/8888" |& getline
>  print $0
>  close("/inet/udp/0/localhost/8888")
>  }
> 
> 
> The difference is in the very first print command.
> I am not really happy with this behaviour (because
> it is different from the equivalent TCP client) but it
> works.

Can you elaborate on why is it needed, or how does it solve the
problem?

Thanks.

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 13 15:38:42 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 929DD3D86
	for <schorr@schorr.telemetry-investments.com>; Sun, 13 Mar 2016 15:38:42 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 835426B1; Sun, 13 Mar 2016 15:38:42 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id D97C66A3
	for <aschorr@telemetry-investments.com>; Sun, 13 Mar 2016 15:38:41 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com D97C66A3
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=skeeve.com
Received: from localhost ([::1]:37371 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1afBqZ-0008V6-L7
	for aschorr@telemetry-investments.com; Sun, 13 Mar 2016 15:38:39 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36471)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1afBqH-00088j-Av
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 15:38:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1afBqE-0003E4-5I
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 15:38:21 -0400
Received: from mxout2.netvision.net.il ([194.90.9.21]:55648)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1afBqD-0003A4-Tn
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 15:38:18 -0400
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; CHARSET=US-ASCII
Received: from skeeve.com ([93.173.16.221]) by mxout2.netvision.net.il
	(Oracle Communications Messaging Server 7.0.5.30.0 64bit (built Oct 22
	2013)) with ESMTPSA id <0O3Z00HSWT7L7U20@mxout2.netvision.net.il> for
	gawk-devel@gnu.org; Sun, 13 Mar 2016 21:38:11 +0200 (IST)
Received: from skeeve.com (skeeve.com [127.0.0.1])
	by skeeve.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id
	u2DJc9Ma009590; Sun, 13 Mar 2016 21:38:09 +0200
Received: (from arnold@localhost)	by skeeve.com (8.14.4/8.14.4/Submit)
	id u2DJc9jP009589;	Sun, 13 Mar 2016 21:38:09 +0200
From: Aharon Robbins <arnold@skeeve.com>
Message-id: <201603131938.u2DJc9jP009589@skeeve.com>
Date: Sun, 13 Mar 2016 21:38:09 +0200
To: juergen.kahrs@googlemail.com, gawk-devel@gnu.org
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
In-reply-to: <56E5920F.2090204@googlemail.com>
User-Agent: Heirloom mailx 12.5 6/20/10
X-detected-operating-system: by eggs.gnu.org: Solaris 10
X-Received-From: 194.90.9.21
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 1063
Lines: 50

It's not working for me. I'm trying in the gawk-4.1.3 branch:

$ git diff | cat
diff --git a/io.c b/io.c
index d700d87..cf45e45 100644
--- a/io.c
+++ b/io.c
@@ -1525,7 +1525,7 @@ socketopen(int family, int type, const char *localpname,
 #ifdef MSG_PEEK
 					char buf[10];
 					struct sockaddr_storage remote_addr;
-					socklen_t read_len = 0;
+					socklen_t read_len = sizeof remote_addr;
 
 					if (recvfrom(socket_fd, buf, 1, MSG_PEEK,
 						(struct sockaddr *) & remote_addr,



$ cat Server 
# Server
BEGIN {
  print strftime() |& "/inet/udp/8888/0/0"
  close("/inet/udp/8888/0/0")
}

$ cat Client 
# Client
BEGIN {
  print "howdy!" |& "/inet/udp/0/localhost/8888"
  "/inet/udp/0/localhost/8888" |& getline
  print $0
  close("/inet/udp/0/localhost/8888")
}

Try to run it. Here, the client exited. Usually it just hangs:

$ ./gawk -f Client & sleep 1 ; ./gawk -f Server &
[1] 9581

[1]+  Done                    ./gawk -f Client
[1] 9583
[aahz:pts/5 gawk.git]$ jobs
[1]+  Running                 ./gawk -f Server &

What am I missing?

Thanks,

Arnold

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 13 16:23:45 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 9A7683D86
	for <schorr@schorr.telemetry-investments.com>; Sun, 13 Mar 2016 16:23:45 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 86C8C6CD; Sun, 13 Mar 2016 16:23:45 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 08BEE6B1
	for <aschorr@telemetry-investments.com>; Sun, 13 Mar 2016 16:23:43 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 08BEE6B1
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=gmail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=sQwC+kbb
Received: from localhost ([::1]:37550 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1afCYB-0003pN-Gg
	for aschorr@telemetry-investments.com; Sun, 13 Mar 2016 16:23:43 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46433)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1afCY8-0003ou-NB
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 16:23:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1afCY4-00064k-MB
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 16:23:40 -0400
Received: from mail-io0-x22f.google.com ([2607:f8b0:4001:c06::22f]:33430)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1afCY4-00064f-Gb
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 16:23:36 -0400
Received: by mail-io0-x22f.google.com with SMTP id n190so201550671iof.0
	for <gawk-devel@gnu.org>; Sun, 13 Mar 2016 13:23:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=date:from:to:cc:subject:message-id:references:mime-version
	:content-disposition:in-reply-to:user-agent;
	bh=IVm0MbmzD6YuWF4+4GUlTWloF98v9mHM5epQyH/0sxo=;
	b=sQwC+kbbncYWnCQR0RsRe/ghGXsbPjPnBuXdGzp+wjcbvHaDmNSwjyWJU9GRIn8yBb
	UOqkJSgqDCxarlxL89WWBmsabcaumOpaDhtp3cYjr7baQi0kA8G19342sOmibhc/m9WM
	CnQkdJv9xWX2ZWIbWvLOfJ1SI1AlujETIaq9rM7dnqmnzNtT7p2WXhxiCcZ+wsdo/YtG
	SV6wJfKDDc0MBIhwoYpzmCcPsK1/D4roHzfOtVVop02/N54fPyyWZHGNcydtoinE8GjI
	xzsbSNbVSJXP7u/GTHVJFW0SOdIxVezg/rSHKGh95Up8RdQBlXccP07QIwADRr243iSN
	zPZg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:date:from:to:cc:subject:message-id:references
	:mime-version:content-disposition:in-reply-to:user-agent;
	bh=IVm0MbmzD6YuWF4+4GUlTWloF98v9mHM5epQyH/0sxo=;
	b=k9QnlWC0lPUmVuQ+o9bfeF/Io7bjNHNZCEh1TpzxYNVHwR0Va+4gSlSKnpiHWM9xGn
	4dIGOtMdyOGbSp2uzqLthrIQAr2Z6BP81rlTcn3Y+mp0tYzn49w/oMrwkBnJhTf4DJZL
	1nN556Vnmqk7fKgFwzmBtdkXgvv938ZLsafCNgLWFvLpQFClIhhdwoR/03cpz6PrbIcU
	QsXpV0a2QPzsb2lG2SmntByVnyp83qRZ6gziIVvgpEUbkykCWPWYV8jXM1NilzuBEWMh
	gO6wYRG/6glaSPZVvfXum5JyXDm/ylEeCrBGeywUAMWRw8o+jMyoRTRgpc9ZBFQMJ+Aw
	/AlA==
X-Gm-Message-State: AD7BkJJx6ykjoDgw0dTBCbhNAtKT6dvXtfCowzXsVE9NxNMbGTvqT0lyYmBt+mvR8M4Pdg==
X-Received: by 10.107.15.153 with SMTP id 25mr20157207iop.3.1457900615558;
	Sun, 13 Mar 2016 13:23:35 -0700 (PDT)
Received: from smok.internal (d23-17-121-177.abhsia.telus.net. [23.17.121.177])
	by smtp.gmail.com with ESMTPSA id r73sm8107252ioe.5.2016.03.13.13.23.34
	(version=TLS1_2 cipher=AES128-SHA bits=128/128);
	Sun, 13 Mar 2016 13:23:35 -0700 (PDT)
Date: Sun, 13 Mar 2016 14:23:32 -0600
From: Michal Jaegermann <michal.jnn@gmail.com>
To: Aharon Robbins <arnold@skeeve.com>
Message-ID: <20160313202332.GA27999@smok.internal>
References: <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
	<201603131938.u2DJc9jP009589@skeeve.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201603131938.u2DJc9jP009589@skeeve.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:4001:c06::22f
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 1219
Lines: 33

On Sun, Mar 13, 2016 at 09:38:09PM +0200, Aharon Robbins wrote:
> It's not working for me. I'm trying in the gawk-4.1.3 branch:

I did that on the top of gawk-4.1-stable and it did work but
not exactly like in the manual.  First I needed a server process,
which was waiting, followed by a modified client.

> $ cat Client 
> # Client
> BEGIN {
>   print "howdy!" |& "/inet/udp/0/localhost/8888"
>   "/inet/udp/0/localhost/8888" |& getline
>   print $0
>   close("/inet/udp/0/localhost/8888")
> }

It looks like that anything will do in the first print, including
an empty string (which will send a line terminator anyway and I did
not try without that one) but such client does exit right away without
a server present.
> 
> What am I missing?

OTOH this shows an expected message if a server is already there.

I do not know at this moment what all of that means.  Looking at
'man recvfrom' I see "If the caller is not interested in the source
address, src_addr and addrlen  should  be specified as NULL".  
This is clearly not the case in the current code.  In the other case
the returned address is truncated to the declared (or provided?) size
of a buffer so zero looks like something indeed too tight.

    Michal

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 13 16:00:17 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 198993D86
	for <schorr@schorr.telemetry-investments.com>; Sun, 13 Mar 2016 16:00:17 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 07C276B1; Sun, 13 Mar 2016 16:00:17 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id A5CC36A3
	for <aschorr@telemetry-investments.com>; Sun, 13 Mar 2016 16:00:16 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com A5CC36A3
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=gD6ZilUE
Received: from localhost ([::1]:37455 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1afCBS-0006yJ-Ho
	for aschorr@telemetry-investments.com; Sun, 13 Mar 2016 16:00:14 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:41640)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1afCBQ-0006yA-4r
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 16:00:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1afCBL-0000D8-77
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 16:00:12 -0400
Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]:36558)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1afCBL-0000Cq-0e
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 16:00:07 -0400
Received: by mail-wm0-x22a.google.com with SMTP id n186so81792090wmn.1
	for <gawk-devel@gnu.org>; Sun, 13 Mar 2016 13:00:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:to:references:message-id:date:user-agent:mime-version
	:in-reply-to:content-transfer-encoding;
	bh=q/+pC+x1gaEBbPJaVPNvg/0U4FaERXmg1fEqKDHz9BY=;
	b=gD6ZilUEZeSRcMb47327Klv/c0Va0MB+yFKhU+vKD6iAmiobrEUq6t+QOJJpqPSJh8
	D4c7LQbROeWMAvvcPenBt575mOMXfIB9AvMlnOHjH0kCcXFCvac6owWCnD/fXg9huf9l
	KXb6c1Fdu+ipFMjDvkJyOZdt0FU7Fh4JkwOzdahhIvFZtDi2kmAm4NZCgScartaU7fjE
	VT+Y6Ngunx9Zj3vqmGyEBY78B4fBCWhYGqKZtlENJeXJoLTpKG5T3r4jJ7yung2AEwUr
	f5++lS3vRj6XlvnYIhdoSpzFKA/3jyO8pVjV0KtbRHZVxgswtC0IKiJgIxeff8AQbgEO
	ErQQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:to:references:message-id:date
	:user-agent:mime-version:in-reply-to:content-transfer-encoding;
	bh=q/+pC+x1gaEBbPJaVPNvg/0U4FaERXmg1fEqKDHz9BY=;
	b=a/ohc8YKeBaUVs0wTSBq08GqwTQAUPCdLRzmiIvETeDEyF6oJEpkqKYPM0Drlt7VMj
	oKl9OrnLWo5EniGtRNBZz+/bPs+5OP24Flk8Y+TNKMidZbVuihPBpZ9UGra0DX5XxcDg
	Ir3MA25qrRBepzKRqzZCh851shZfoTu+ebGE17Twn3W55eB+phNCZTb4u4APl9CjyANb
	WUWEjyB9LreGYq5+2eaQNTboguLaOFZyVABS7QOkGn/fef3Yt4w7E3zrKbDIgoYNhduN
	1wU4dRqT+GRB/jkKLk9H2OYAmGAknEyI1rqH4qpiGuaSc6iAczGfohMLUvRYIyDXKR6C
	nkJw==
X-Gm-Message-State: AD7BkJLw4YTOK8QE3C+0CJr81CqEDU9tloWX2TRddQmmVb2OvoKhb/mtvHNuvrl0kk1A5Q==
X-Received: by 10.194.189.143 with SMTP id gi15mr20139665wjc.54.1457899206276; 
	Sun, 13 Mar 2016 13:00:06 -0700 (PDT)
Received: from [192.168.0.11] (ip5f5ac869.dynamic.kabel-deutschland.de.
	[95.90.200.105]) by smtp.googlemail.com with ESMTPSA id
	t8sm18981530wjy.41.2016.03.13.13.00.05
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 13 Mar 2016 13:00:05 -0700 (PDT)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
To: Aharon Robbins <arnold@skeeve.com>, gawk-devel@gnu.org
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
	<201603131938.u2DJc9jP009589@skeeve.com>
Message-ID: <56E5C6C4.9000605@googlemail.com>
Date: Sun, 13 Mar 2016 21:00:04 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <201603131938.u2DJc9jP009589@skeeve.com>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::22a
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 123
Lines: 5

Am 13.03.2016 um 20:38 schrieb Aharon Robbins:
> What am I missing?

Start the server first, then the client, that's all.


From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 13 23:41:39 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 575DE223
	for <schorr@schorr.telemetry-investments.com>; Sun, 13 Mar 2016 23:41:39 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 449A56B1; Sun, 13 Mar 2016 23:41:39 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id AA19F598
	for <aschorr@telemetry-investments.com>; Sun, 13 Mar 2016 23:41:38 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com AA19F598
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=skeeve.com
Received: from localhost ([::1]:38833 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1afJNw-0007Yr-7O
	for aschorr@telemetry-investments.com; Sun, 13 Mar 2016 23:41:36 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36770)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1afJNt-0007Yc-Nb
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 23:41:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1afJNq-0001DO-Ev
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 23:41:33 -0400
Received: from freefriends.org ([96.88.95.60]:50767)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1afJNq-0001DK-6h
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 23:41:30 -0400
X-Envelope-From: arnold@skeeve.com
Received: from freefriends.org (localhost [127.0.0.1])
	by freefriends.org (8.14.9/8.14.9) with ESMTP id u2E3aRx9017399;
	Sun, 13 Mar 2016 21:36:27 -0600
Received: (from arnold@localhost)
	by freefriends.org (8.14.9/8.14.9/submit) id u2E3aR24017398;
	Mon, 14 Mar 2016 03:36:27 GMT
From: arnold@skeeve.com
Message-Id: <201603140336.u2E3aR24017398@freefriends.org>
X-Authentication-Warning: frenzy.freefriends.org: arnold set sender to
	arnold@skeeve.com using -f
Date: Sun, 13 Mar 2016 21:36:27 -0600
To: juergen.kahrs@googlemail.com, gawk-devel@gnu.org, arnold@skeeve.com
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
	<201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
In-Reply-To: <56E5C6C4.9000605@googlemail.com>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by freefriends.org id
	u2E3aRx9017399
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 96.88.95.60
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 253
Lines: 12

"J=FCrgen Kahrs" <juergen.kahrs@googlemail.com> wrote:

> Am 13.03.2016 um 20:38 schrieb Aharon Robbins:
> > What am I missing?
>
> Start the server first, then the client, that's all.

No difference. Both hang.

Does it work for you in master?

Arnold

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 13 23:57:13 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 501F0223
	for <schorr@schorr.telemetry-investments.com>; Sun, 13 Mar 2016 23:57:13 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 3C2BE6B1; Sun, 13 Mar 2016 23:57:13 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 0E027598
	for <aschorr@telemetry-investments.com>; Sun, 13 Mar 2016 23:57:12 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 0E027598
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=skeeve.com
Received: from localhost ([::1]:38862 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1afJd1-0000N9-0b
	for aschorr@telemetry-investments.com; Sun, 13 Mar 2016 23:57:11 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39407)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1afJcy-0000Ma-Ch
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 23:57:09 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1afJcv-0004di-4p
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 23:57:08 -0400
Received: from mxout2.netvision.net.il ([194.90.9.21]:48324)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1afJcu-0004dL-TM
	for gawk-devel@gnu.org; Sun, 13 Mar 2016 23:57:05 -0400
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; CHARSET=US-ASCII
Received: from skeeve.com ([93.173.16.221]) by mxout2.netvision.net.il
	(Oracle Communications Messaging Server 7.0.5.30.0 64bit (built Oct 22
	2013)) with ESMTPSA id <0O40005LBGAPMP70@mxout2.netvision.net.il> for
	gawk-devel@gnu.org; Mon, 14 Mar 2016 05:56:49 +0200 (IST)
Received: from skeeve.com (skeeve.com [127.0.0.1])
	by skeeve.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id
	u2E3umlH009439; Mon, 14 Mar 2016 05:56:48 +0200
Received: (from arnold@localhost)	by skeeve.com (8.14.4/8.14.4/Submit)
	id u2E3umxW009438;	Mon, 14 Mar 2016 05:56:48 +0200
From: Aharon Robbins <arnold@skeeve.com>
Message-id: <201603140356.u2E3umxW009438@skeeve.com>
Date: Mon, 14 Mar 2016 05:56:48 +0200
To: juergen.kahrs@googlemail.com, gawk-devel@gnu.org, arnold@skeeve.com
References: <83egbwaevv.fsf@gnu.org> <56D3524F.1040600@googlemail.com>
	<201602290529.u1T5Tk2m002991@skeeve.com>
	<56D48A2C.4040702@googlemail.com>
	<20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
	<201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
	<201603140336.u2E3aR24017398@freefriends.org>
In-reply-to: <201603140336.u2E3aR24017398@freefriends.org>
User-Agent: Heirloom mailx 12.5 6/20/10
X-detected-operating-system: by eggs.gnu.org: Solaris 10
X-Received-From: 194.90.9.21
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 1047
Lines: 37

> From arnold@skeeve.com  Mon Mar 14 05:44:58 2016
> Return-Path: <arnold@skeeve.com>
> X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
> 	frenzy.freefriends.org
> X-Spam-Level: 
> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,
> 	TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.1
> X-Envelope-From: arnold@skeeve.com
> From: arnold@skeeve.com
> Date: Sun, 13 Mar 2016 21:36:27 -0600
> To: juergen.kahrs@googlemail.com, gawk-devel@gnu.org, arnold@skeeve.com
> Subject: Re: [gawk-devel] UDP networking doesn't work?
> Content-Type: text/plain; charset=iso-8859-1
> Status: R
>
> "J?rgen Kahrs" <juergen.kahrs@googlemail.com> wrote:
>
> > Am 13.03.2016 um 20:38 schrieb Aharon Robbins:
> > > What am I missing?
> >
> > Start the server first, then the client, that's all.
>
> No difference. Both hang.
>
> Does it work for you in master?
>
> Arnold
>

I blew it. After making the change it works for me now.

Juergen, can you send me an update to gawkinet.texi?  In the meantime
I'll commit the fix.

Thanks!

Arnold

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Mon Mar 14 13:32:30 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 300482C9
	for <schorr@schorr.telemetry-investments.com>; Mon, 14 Mar 2016 13:32:30 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 2065F6AC; Mon, 14 Mar 2016 13:32:30 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id C951D4E8
	for <aschorr@telemetry-investments.com>; Mon, 14 Mar 2016 13:32:29 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com C951D4E8
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=gmail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BZ5FE6tr
Received: from localhost ([::1]:42733 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1afWLz-0000aC-Tj
	for aschorr@telemetry-investments.com; Mon, 14 Mar 2016 13:32:27 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:52262)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1afWLu-0000Zo-GR
	for gawk-devel@gnu.org; Mon, 14 Mar 2016 13:32:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1afWLq-00077e-Fo
	for gawk-devel@gnu.org; Mon, 14 Mar 2016 13:32:22 -0400
Received: from mail-ig0-x236.google.com ([2607:f8b0:4001:c05::236]:38806)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1afWLq-00077I-AL
	for gawk-devel@gnu.org; Mon, 14 Mar 2016 13:32:18 -0400
Received: by mail-ig0-x236.google.com with SMTP id ig19so67305486igb.1
	for <gawk-devel@gnu.org>; Mon, 14 Mar 2016 10:32:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=date:from:to:cc:subject:message-id:references:mime-version
	:content-disposition:in-reply-to:user-agent;
	bh=pZ9e5h2J65b3fZ/nXyMZl9FBZ5QBM+JlqEfv8uZ3Cko=;
	b=BZ5FE6trkz65XDpY+yPjKrJUa0NOaBDBVnatCU04SXwPmpOMoYRg4IlNPsESugY2fn
	h1dlsqlZB6khAwrnGzfCX5ki4QG7gYiEv2KTkALdbDXSSwUpbrV48/UYQrw8ZjtR4GuC
	tmpuoHlFnGYCurA9WwCiuNzRziFuz605L8gmNUgCIE6N8sqRIonggdqfsVxeyWRGdMNR
	MjiTSlmrh+6oo+Ch9vQZXPBZdn1SSEVPYt8hsqtkmSObsfEjxKM6mmd/7KdYuvshKyTf
	GpOZcFBpTLbi5SxBpIigHtBOW65hVBvK3zJC/QvsT0bGnXIhNnOgAPIimu9fNXY+dX4u
	d//A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:date:from:to:cc:subject:message-id:references
	:mime-version:content-disposition:in-reply-to:user-agent;
	bh=pZ9e5h2J65b3fZ/nXyMZl9FBZ5QBM+JlqEfv8uZ3Cko=;
	b=lgESyt+CwnWehin9Q5Pamrz78uO7HnudAPpu7RoV8cksSnroMeaA5rNmt0ZlCLdwFL
	VHKCDbGACcHInDQSyPkd130SH7oYU5zotXHV0/QkkTETIQc9qzjZ962DCGtfl2TQr/rV
	Gp3eqhu9LeAQFtahxBdr+cTuoc8prOh62IzCj/F539L+xIW7F6QRI1phyj+hJlFwnUa3
	9J4Jw6Wzsf1fpZ4QYcs1sxrJub2CRiidcJPqj/YZOFjEsc54/qeO643wtgi+XGCoi+wD
	w90s3HXEquPjsvXNPdsP+u11ZQ0Rg5lm9YqJxUCHYcEa87eo6YfJHI9EouZC01J5nCLm
	cEFA==
X-Gm-Message-State: AD7BkJLm+TRK+OuuipHbFJL68QW1im3335A4UIDV1t3gtT14xpzgYpvvHa0HQ3/hGU6e6g==
X-Received: by 10.50.30.201 with SMTP id u9mr17793302igh.63.1457976737238;
	Mon, 14 Mar 2016 10:32:17 -0700 (PDT)
Received: from smok.internal (d23-17-121-177.abhsia.telus.net. [23.17.121.177])
	by smtp.gmail.com with ESMTPSA id p8sm2685149igi.2.2016.03.14.10.32.16
	(version=TLS1_2 cipher=AES128-SHA bits=128/128);
	Mon, 14 Mar 2016 10:32:16 -0700 (PDT)
Date: Mon, 14 Mar 2016 11:32:08 -0600
From: Michal Jaegermann <michal.jnn@gmail.com>
To: Aharon Robbins <arnold@skeeve.com>
Message-ID: <20160314173208.GA31194@smok.internal>
References: <20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
	<201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
	<201603140336.u2E3aR24017398@freefriends.org>
	<201603140356.u2E3umxW009438@skeeve.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201603140356.u2E3umxW009438@skeeve.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:4001:c05::236
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 453
Lines: 15

On Mon, Mar 14, 2016 at 05:56:48AM +0200, Aharon Robbins wrote:
> 
> Juergen, can you send me an update to gawkinet.texi?  In the meantime
> I'll commit the fix.

That change in io.c looks to me indeed correct but before going too far
does anybody have a good explanation why this "magic incantation"

> print "howdy!" |& "/inet/udp/0/localhost/8888"

in a sample client is needed, what actually is doing, and why
this is different for tcp?

   Michal


From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Mon Mar 14 14:01:22 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 7C18D410
	for <schorr@schorr.telemetry-investments.com>; Mon, 14 Mar 2016 14:01:22 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 731376AC; Mon, 14 Mar 2016 14:01:22 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id D6F3F4E8
	for <aschorr@telemetry-investments.com>; Mon, 14 Mar 2016 14:01:21 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com D6F3F4E8
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=ryVkKTx6
Received: from localhost ([::1]:43128 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1afWnx-0006FG-B6
	for aschorr@telemetry-investments.com; Mon, 14 Mar 2016 14:01:21 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57523)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1afWZk-0004GS-L1
	for gawk-devel@gnu.org; Mon, 14 Mar 2016 13:46:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1afWZh-0003C7-6d
	for gawk-devel@gnu.org; Mon, 14 Mar 2016 13:46:40 -0400
Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:37244)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1afWZg-0003Ac-R4
	for gawk-devel@gnu.org; Mon, 14 Mar 2016 13:46:37 -0400
Received: by mail-wm0-x22f.google.com with SMTP id p65so113114501wmp.0
	for <gawk-devel@gnu.org>; Mon, 14 Mar 2016 10:46:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:to:references:cc:message-id:date:user-agent
	:mime-version:in-reply-to;
	bh=6n4ZCGJwx9tVj+7d31uvOD0WzNjI8AN9u1+PscAuF1w=;
	b=ryVkKTx65M9cXRFDi4maEk8Ycla3HsArEAUGWOLx6lNm/gxmOp+ZehaXl7lksBa6G1
	vg6Ks7YBx+EO0HzlWLLPADJK9kfqd0crSEs55koYzmcDMf9wq8G+PoZMdsxUzSUmqU1T
	EnZZDngA1ToPOc2stzmmf+Rp+yMSsZCnfR2opalrMboGNrwVIoV1w/IIQoR9KAUT+Qxv
	ACvJ6x/XycDqalxOGy0uFygy9hk/b45624TcVzPVifkeDZM/cyoHRlVlrGONtPzVRckN
	HnQmhsJshdBO0O8SzPYpINEAN5cY5OCmzI2uwwMVVubhPQJE88bhJfPj5qgUHvh+j1tm
	sQZA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:to:references:cc:message-id:date
	:user-agent:mime-version:in-reply-to;
	bh=6n4ZCGJwx9tVj+7d31uvOD0WzNjI8AN9u1+PscAuF1w=;
	b=PpjZ+nYDlgaQa2UM92f8gWPz4PQPZFnLeyqRNMGCZb/CM6Okq8Y52Vr/3hMgd1Zgp2
	z7iNmgChQ13G0GqzpQkXX/blhCfBHaq3MOnGxGjzba7WRDQMlmvf11sA8Ep5Wt5+h/R7
	zEHSVh9/rwjQaBCCNbTjYRFgQ/EHm9z3mGMiGd/Wd3zLFUNau8qtIilsgfrHrOmNVvpu
	i3VIHIRePJ+yRRR2No02ydyUxUBbCjX9956V69hy7lG2X2a5iSt23q6sXmUbt0QNXNI/
	sl8EFivYIw+m5vZgfNFwibrmNsYeqj4d4kz86ZXb+I8UA7+jf5n9kyRF+eF65hLDW3DF
	1n3Q==
X-Gm-Message-State: AD7BkJI35sgPvUuYzIsMivfSaxunrAPH/8ddjEhwaZlrUPdPkT5jMETRLfwxU0v3h0WAcA==
X-Received: by 10.194.94.229 with SMTP id df5mr29417180wjb.133.1457977595816; 
	Mon, 14 Mar 2016 10:46:35 -0700 (PDT)
Received: from [192.168.0.11] (ip5f5ac8b9.dynamic.kabel-deutschland.de.
	[95.90.200.185]) by smtp.googlemail.com with ESMTPSA id
	u202sm17231836wmd.24.2016.03.14.10.46.34
	(version=TLSv1/SSLv3 cipher=OTHER);
	Mon, 14 Mar 2016 10:46:35 -0700 (PDT)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
To: Michal Jaegermann <michal.jnn@gmail.com>,
	Aharon Robbins <arnold@skeeve.com>
References: <20160229203945.GA30054@ti129.telemetry-investments.com>
	<56DC4565.9060302@googlemail.com>
	<20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
	<201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
	<201603140336.u2E3aR24017398@freefriends.org>
	<201603140356.u2E3umxW009438@skeeve.com>
	<20160314173208.GA31194@smok.internal>
Message-ID: <56E6F8F9.5010908@googlemail.com>
Date: Mon, 14 Mar 2016 18:46:33 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <20160314173208.GA31194@smok.internal>
Content-Type: multipart/alternative;
	boundary="------------070408080501020707080305"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::22f
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
X-Status: A
Content-Length: 4644
Lines: 129

This is a multi-part message in MIME format.
--------------070408080501020707080305
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit

Am 14.03.2016 um 18:32 schrieb Michal Jaegermann:
> On Mon, Mar 14, 2016 at 05:56:48AM +0200, Aharon Robbins wrote:
>> Juergen, can you send me an update to gawkinet.texi?  In the meantime
>> I'll commit the fix.
> That change in io.c looks to me indeed correct but before going too far
> does anybody have a good explanation why this "magic incantation"
>
>> print "howdy!" |& "/inet/udp/0/localhost/8888"
> in a sample client is needed, what actually is doing, and why
> this is different for tcp?
>
>    Michal
>

Eli had already asked the same question.
When I answered his question, I forgot to send a
copy of my answer to the mailing list.
This is what I sent to Eli:

    In the case of UDP, the "print" commands is the one
    that actually sends data so the there is a connection.
    UDP and "connection" may sound strange to anyone
    who has learned that UDP is a connection-less protocol.
    Connection here means that the connect() system call
    has completed its work and completed the "association"
    between a certain socket and an IP address. There are
    subtle differences between connect() for TCP and UDP.
    See man page for details.

    If you use the UDP client script as it is currently shown
    in the doc, the client gets not quite connected to the
    server (the server notices nothing, so sends nothing,
    so the client receives nothing). This is of course an
    ugly asymmetry between TCP and UDP as implemented
    in GAWK. If someone suggests a more symmetric
    solution, then it is probably worth changing the behaviour.
    On the other hand we should be aware that this subtlety
    is just one of many details that are hidden in the socket
    API, invisible and intractable for the GAWK user.
    We should not strive for making all details visible and
    controllable for the GAWK user, this would be too much.





--------------070408080501020707080305
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 7bit

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Am 14.03.2016 um 18:32 schrieb Michal
      Jaegermann:<br>
    </div>
    <blockquote cite="mid:20160314173208.GA31194@smok.internal"
      type="cite">
      <pre wrap="">On Mon, Mar 14, 2016 at 05:56:48AM +0200, Aharon Robbins wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">
Juergen, can you send me an update to gawkinet.texi?  In the meantime
I'll commit the fix.
</pre>
      </blockquote>
      <pre wrap="">
That change in io.c looks to me indeed correct but before going too far
does anybody have a good explanation why this "magic incantation"

</pre>
      <blockquote type="cite">
        <pre wrap="">print "howdy!" |&amp; "/inet/udp/0/localhost/8888"
</pre>
      </blockquote>
      <pre wrap="">
in a sample client is needed, what actually is doing, and why
this is different for tcp?

   Michal

</pre>
    </blockquote>
    <br>
    Eli had already asked the same question.<br>
    When I answered his question, I forgot to send a<br>
    copy of my answer to the mailing list.<br>
    This is what I sent to Eli:<br>
    <blockquote>
      <pre wrap="">In the case of UDP, the "print" commands is the one
that actually sends data so the there is a connection.
UDP and "connection" may sound strange to anyone
who has learned that UDP is a connection-less protocol.
Connection here means that the connect() system call
has completed its work and completed the "association"
between a certain socket and an IP address. There are
subtle differences between connect() for TCP and UDP.
See man page for details.

If you use the UDP client script as it is currently shown
in the doc, the client gets not quite connected to the
server (the server notices nothing, so sends nothing,
so the client receives nothing). This is of course an
ugly asymmetry between TCP and UDP as implemented
in GAWK. If someone suggests a more symmetric
solution, then it is probably worth changing the behaviour.
On the other hand we should be aware that this subtlety
is just one of many details that are hidden in the socket
API, invisible and intractable for the GAWK user.
We should not strive for making all details visible and
controllable for the GAWK user, this would be too much.


</pre>
    </blockquote>
    <br>
    <br>
  </body>
</html>

--------------070408080501020707080305--

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Mon Mar 14 14:18:04 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 862E42C9
	for <schorr@schorr.telemetry-investments.com>; Mon, 14 Mar 2016 14:18:04 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 7F5D86AC; Mon, 14 Mar 2016 14:18:04 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 516914E8
	for <aschorr@telemetry-investments.com>; Mon, 14 Mar 2016 14:18:03 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 516914E8
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=telemetry-investments.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=fail reason="key not found in DNS" (0-bit key) header.d=telemetry-investments.com header.i=@telemetry-investments.com header.b=iNk59iBE
Received: from localhost ([::1]:43243 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1afX47-0002SW-Hh
	for aschorr@telemetry-investments.com; Mon, 14 Mar 2016 14:18:03 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:40926)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1afX45-0002SP-2Q
	for gawk-devel@gnu.org; Mon, 14 Mar 2016 14:18:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1afX40-0004JM-2s
	for gawk-devel@gnu.org; Mon, 14 Mar 2016 14:18:01 -0400
Received: from gw3a.telemetry-investments.com ([38.76.0.51]:57589
	helo=sv3.telemetry-investments.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1afX3z-0004JI-VJ
	for gawk-devel@gnu.org; Mon, 14 Mar 2016 14:17:56 -0400
Received: from ti129.telemetry-investments.com (ti129 [192.168.53.129])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 874434E8;
	Mon, 14 Mar 2016 14:17:53 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=telemetry-investments.com; s=tele1409; t=1457979474;
	bh=2bX596H4mJG6UI1zSGfG2VUVMUILgtYiQwGSC5t8qJY=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=iNk59iBEoV/I7WpwrQ6PXHss8w1eYy5AFyaOgvQPDbycfkKtJqewipmEWhwg4ke7/
	R4605/F2a9hnc2K72xfHXLBNyN6vcc7I6XxEEvKnqilS3xgwwjW+ntMzNV8G0uO3Qa
	Cq9g3EOfsBiPSvKnhBD01+ciCEUIO32bRXhpZbIw=
Received: by ti129.telemetry-investments.com (Postfix, from userid 300)
	id 78232410; Mon, 14 Mar 2016 14:17:53 -0400 (EDT)
Date: Mon, 14 Mar 2016 14:17:53 -0400
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
To: =?iso-8859-1?Q?J=FCrgen?= Kahrs <juergen.kahrs@googlemail.com>
Message-ID: <20160314181753.GA30914@ti129.telemetry-investments.com>
References: <20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
	<201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
	<201603140336.u2E3aR24017398@freefriends.org>
	<201603140356.u2E3umxW009438@skeeve.com>
	<20160314173208.GA31194@smok.internal>
	<56E6F8F9.5010908@googlemail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <56E6F8F9.5010908@googlemail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 38.76.0.51
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 932
Lines: 25

Hi,

This is somewhat off-topic, but I continue to believe that the networking
implementation in gawk doesn't really make sense, as discussed back in
June/July 2013.  Now that we have non-blocking I/O (using
PROCINFO["INPUT_NAME", "RETRY"]) and the select extension in gawkextlib, we can
do this the right way.  The existing TCP solution accepts a single connection
and then closes the listener socket in io.c:socketopen:

	if (listen(socket_fd, 1) >= 0
	    && (clientsocket_fd = accept(socket_fd,
		(struct sockaddr *) & remote_addr,
		& namelen)) >= 0) {
		closemaybesocket(socket_fd);
		socket_fd = clientsocket_fd;
		break;
	}

To me, these UDP problems are a reminder that the networking paradigm in 
gawk is flawed. My guess is that nobody really uses anything other than
the TCP client feature, so maybe we should scrap the UDP support and TCP
server support and reimplement them to work in a sane fashion...

Regards,
Andy

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 20 16:13:08 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id C1AA437B
	for <schorr@schorr.telemetry-investments.com>; Sun, 20 Mar 2016 16:13:08 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id B66AE6BC; Sun, 20 Mar 2016 16:13:08 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 4E4E9369
	for <aschorr@telemetry-investments.com>; Sun, 20 Mar 2016 16:13:07 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 4E4E9369
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=H3BSRtto
Received: from localhost ([::1]:54344 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1ahjii-0006Ns-2U
	for aschorr@telemetry-investments.com; Sun, 20 Mar 2016 16:13:04 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57533)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1ahjic-0006Nh-NM
	for gawk-devel@gnu.org; Sun, 20 Mar 2016 16:12:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1ahjiX-0002X0-O1
	for gawk-devel@gnu.org; Sun, 20 Mar 2016 16:12:58 -0400
Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:38600)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1ahjiX-0002W5-CU
	for gawk-devel@gnu.org; Sun, 20 Mar 2016 16:12:53 -0400
Received: by mail-wm0-x229.google.com with SMTP id l68so99729118wml.1
	for <gawk-devel@gnu.org>; Sun, 20 Mar 2016 13:12:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:references:cc:message-id:date:user-agent:mime-version
	:in-reply-to:content-transfer-encoding;
	bh=o2tHEENYDte40oEYnSo4eBCjPoJBKKUbfQzeklnRRrw=;
	b=H3BSRttocbo5B/5AouLLnFmsHYjI50La9NwL4y11CAi0rFxqEfEJopHs4tHZAa9ocD
	6vJp8yc4czxPttAx9jR+M6xvZHDGmCFHexbU0798WH6xzNT6eJ9qZJGnAoLck17ewkqb
	FPIAIApaM/sT8i1SeExVfoE3Cbr/BNuOVKAWl5oz+X6ue66Y36jGLcf9s2X8RnzVUCnw
	ThfOP6Rq7W/hx5U9M6PJHLybmX77RSDKRNE7jsbAkUaiNV0tgn4I5Yh60T3U6xN9csco
	1ZknNtH1v3i/wIEz0cfhpfPCSDN7vm8M6QJDnqJIreCwDAspMY0k9v7Lkh1t9dzbu9Az
	qebQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:references:cc:message-id:date
	:user-agent:mime-version:in-reply-to:content-transfer-encoding;
	bh=o2tHEENYDte40oEYnSo4eBCjPoJBKKUbfQzeklnRRrw=;
	b=fU58V5xtROq4M/n2P4O0o0IlTv9cmrcIbKupAF7e9bN7/IovzrFzcAaNCp440SnQ5O
	eq92bVy2+DQ9n7uJdxgcdCt8v7hqLHp5sqfmjXPICJekNBwtmR1yvRNT6t2ZSjppKVau
	X5WWu8YYwRKJ9D0vx3B2V4jVRaBf5kFjuEPnXA4QgkDZMr9ab49mtV1KMzdfqr3poFDs
	ZH+WRlLl8j4BLYEmoIpYfQ4a2JH+hy+BQ3UWokiVoDVzKA9cuyhFEPYm0fgLvE9x35pf
	PCYvKEUKwjxPavkHdl2IKyvXFREMt33TP1nFOt712PvsrawTd3KqlBwi4O9sCmSKPCqE
	vzQQ==
X-Gm-Message-State: AD7BkJKhiMGHrmiHcjQFrKW2uoHq4beN6opadGjxbPfEDCwkAJxE6bU6MFUoqh/J7SOb5w==
X-Received: by 10.28.141.141 with SMTP id p135mr7543838wmd.8.1458504772383;
	Sun, 20 Mar 2016 13:12:52 -0700 (PDT)
Received: from [192.168.0.11] (ip5f5ac874.dynamic.kabel-deutschland.de.
	[95.90.200.116]) by smtp.googlemail.com with ESMTPSA id
	h67sm9166584wmf.15.2016.03.20.13.12.51 for <gawk-devel@gnu.org>
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 20 Mar 2016 13:12:51 -0700 (PDT)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
References: <20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
	<201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
	<201603140336.u2E3aR24017398@freefriends.org>
	<201603140356.u2E3umxW009438@skeeve.com>
	<20160314173208.GA31194@smok.internal>
	<56E6F8F9.5010908@googlemail.com>
	<20160314181753.GA30914@ti129.telemetry-investments.com>
Cc: gawk-devel@gnu.org
Message-ID: <56EF0442.3050605@googlemail.com>
Date: Sun, 20 Mar 2016 21:12:50 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <20160314181753.GA30914@ti129.telemetry-investments.com>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::229
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 2712
Lines: 56

Hello Andrew,

> This is somewhat off-topic, but I continue to believe that the networking
> implementation in gawk doesn't really make sense, as discussed back in
> June/July 2013.  Now that we have non-blocking I/O (using
> PROCINFO["INPUT_NAME", "RETRY"]) and the select extension in gawkextlib, we can
> do this the right way.  The existing TCP solution accepts a single connection
> and then closes the listener socket in io.c:socketopen:
>
> 	if (listen(socket_fd, 1) >= 0
> 	    && (clientsocket_fd = accept(socket_fd,
> 		(struct sockaddr *) & remote_addr,
> 		& namelen)) >= 0) {
> 		closemaybesocket(socket_fd);
> 		socket_fd = clientsocket_fd;
> 		break;
> 	}

The current networking paradigm tries to treat every
networking connection like a file. Trying to treat a connection
like a file looked like a straightforward idea at that time, but it
was in fact a bit difficult because there were so many differences
between connections and files (for example port numbers, the
difference between raw, datagram and stream data, and also
socket options). Since then, the diversity in differences has
increased ever more. It is obvious that all these details cannot
be treated in detail and in portable manner.

I understand your comment as a suggestion that the
networking API should handle only a minimum of details
and more advanced things should be handled with other
mechanisms (that are either part of gawk or one of its
extensions). I would agree, I see no other way that is
realistic in the long term.

> To me, these UDP problems are a reminder that the networking paradigm in 
> gawk is flawed. My guess is that nobody really uses anything other than
> the TCP client feature, so maybe we should scrap the UDP support and TCP
> server support and reimplement them to work in a sane fashion...

When I implemented the support for UDP, I thought it would
be possible to offer the same networking API for TCP and UDP,
for clients and for servers. As we have seen, even the example
scripts that we tried cannot handle TCP and UDP in the same way.
Even for TCP, the handling of differences between client and server
connections is silently hidden in the parameters that are passed.
This is ugly and not user-friendly of course.

Your guess that no one really uses UDP may be true.
Concerning the use of TCP server-scripts I can only guess.
So your suggestion to remove the UDP support makes sense.
This would allow for a real simplification in gawk's networking internals.
Your suggestion to remove support for the TCP server side
would simplify the implementation to a degree that the control
flow in the source code could be called "straightforward".
All in all, I would agree with your suggestions.

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 20 23:55:17 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 22EA937B
	for <schorr@schorr.telemetry-investments.com>; Sun, 20 Mar 2016 23:55:17 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 1139B681; Sun, 20 Mar 2016 23:55:17 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 788F167D
	for <aschorr@telemetry-investments.com>; Sun, 20 Mar 2016 23:55:15 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 788F167D
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=skeeve.com
Received: from localhost ([::1]:55446 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1ahqvx-0000mz-HC
	for aschorr@telemetry-investments.com; Sun, 20 Mar 2016 23:55:13 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49069)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ahqvv-0000mt-Nr
	for gawk-devel@gnu.org; Sun, 20 Mar 2016 23:55:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ahqvq-0007U7-NU
	for gawk-devel@gnu.org; Sun, 20 Mar 2016 23:55:11 -0400
Received: from mxout2.netvision.net.il ([194.90.9.21]:57721)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1ahqvq-0007TF-FH
	for gawk-devel@gnu.org; Sun, 20 Mar 2016 23:55:06 -0400
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; CHARSET=US-ASCII
Received: from skeeve.com ([93.173.16.221]) by mxout2.netvision.net.il
	(Oracle Communications Messaging Server 7.0.5.30.0 64bit (built Oct 22
	2013)) with ESMTPSA id <0O4D00C03EVN0600@mxout2.netvision.net.il> for
	gawk-devel@gnu.org; Mon, 21 Mar 2016 05:55:00 +0200 (IST)
Received: from skeeve.com (skeeve.com [127.0.0.1])
	by skeeve.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id
	u2L3sxaK016470; Mon, 21 Mar 2016 05:54:59 +0200
Received: (from arnold@localhost)	by skeeve.com (8.14.4/8.14.4/Submit)
	id u2L3swdW016469;	Mon, 21 Mar 2016 05:54:58 +0200
From: Aharon Robbins <arnold@skeeve.com>
Message-id: <201603210354.u2L3swdW016469@skeeve.com>
Date: Mon, 21 Mar 2016 05:54:58 +0200
To: juergen.kahrs@googlemail.com
References: <20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
	<201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
	<201603140336.u2E3aR24017398@freefriends.org>
	<201603140356.u2E3umxW009438@skeeve.com>
	<20160314173208.GA31194@smok.internal>
	<56E6F8F9.5010908@googlemail.com>
	<20160314181753.GA30914@ti129.telemetry-investments.com>
	<56EF0442.3050605@googlemail.com>
In-reply-to: <56EF0442.3050605@googlemail.com>
User-Agent: Heirloom mailx 12.5 6/20/10
X-detected-operating-system: by eggs.gnu.org: Solaris 10
X-Received-From: 194.90.9.21
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 963
Lines: 28

Hi.

I don't have a problem with marking UDP as obsolete.

I would prefer to continue to be able to have both server and client
on the TCP side.

I would strongly prefer to do this in a way that doesn't break old
programs using TCP.

One thing that bothers me right now is that getaddrinfo() returns
a linked list of struct addrinfo, and the gawk paradigm assumes that
/inet/... will only map to one possible connection, an (IPv?, address, port)
triple.  This should be dealt with reasonably in the case that more
than one struct addrinfo comes back. (Probably a fatal error.)

Andy and Juergen, feel free to work on a design and set up a separate
branch off of master to work on this.

In the meantime, I have updated the doc based on one of Juergen's emails
and pushed the changes to the repo.

(As a side note, how did the original UDP client ever work? I have a vague
memory of having tested it and that it did work... That also bothers me.)

Thanks,

Arnold

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 27 15:24:09 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 7DB0422A
	for <schorr@schorr.telemetry-investments.com>; Sun, 27 Mar 2016 15:24:09 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 727926A9; Sun, 27 Mar 2016 15:24:09 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 29F5D36A
	for <aschorr@telemetry-investments.com>; Sun, 27 Mar 2016 15:24:08 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 29F5D36A
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=Lix8Cacv
Received: from localhost ([::1]:37179 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1akGIA-0007bd-0d
	for aschorr@telemetry-investments.com; Sun, 27 Mar 2016 15:24:06 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43872)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1akGI7-0007bY-Di
	for gawk-devel@gnu.org; Sun, 27 Mar 2016 15:24:04 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1akGI4-00037V-7Z
	for gawk-devel@gnu.org; Sun, 27 Mar 2016 15:24:03 -0400
Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36508)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1akGI3-00037O-W5
	for gawk-devel@gnu.org; Sun, 27 Mar 2016 15:24:00 -0400
Received: by mail-wm0-x242.google.com with SMTP id l68so16394571wml.3
	for <gawk-devel@gnu.org>; Sun, 27 Mar 2016 12:23:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:to:references:cc:message-id:date:user-agent
	:mime-version:in-reply-to:content-transfer-encoding;
	bh=XWsAXxBAmHCZbTTAxl0zQUZjQ0yb4isOCqIUw2KU1Fk=;
	b=Lix8CacvxJnUFk/mLgyhAmx04VDGwZLDL6KVXRsKDYSlyNlJ7FPk4dFagDGAg8aurZ
	7zyVjY5vxXSgtKUw7m2oawF5uBkYuyXl5xvgD6Ogq59FjaAGr94Gkbt/9CWjG27OCZgg
	K7dHW+uIdCgzkgsLLzZj3+qyA66/2/VHBKhkyG2TnWEXuIxcRrO40N5tG1UBz7J739gP
	3AY8lrF3+Vh/UMh0vC2ywC39rzIEIOX3vATK5pYHzSv7GAZLaq2/NrL+TSaj/ziIdum5
	I3uRScvEBZQh2YJq7p7WjOgHvAMrV7mkxdnync1I9F6mseCTWz4PtHlWfWOCTVcerVz/
	IFMw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:to:references:cc:message-id:date
	:user-agent:mime-version:in-reply-to:content-transfer-encoding;
	bh=XWsAXxBAmHCZbTTAxl0zQUZjQ0yb4isOCqIUw2KU1Fk=;
	b=Y84qRzpqkCsIvjdScyYnEriHyB6QGSSwi5CC4aBSOj6N9/HO1j4lyy1TAOyH12MnSp
	l1TKTKUKUB/z4Bu5BPYx4mleRARwEuc0iB04ZR5EiK/4Xv9Jufqkbqj9ml86nLHixOvp
	xiX1wLDi6BktB7eFjRVelz7PnioE28mH++guqiSD75hMCX/g0vkMps/am/8uo1ScyEVj
	zLWmiz7iD2sDNrDpMewyzaQFBpziHYoVTXN8aKC369yeiHuYasvJ7SYjlQgTmaRR2CzL
	TOlYN+LXFCIagBnAaY7v2WXgMtBtnWnjcysCQnXiDSUx8jEio87sP3PextEKr0B64KFZ
	Me6A==
X-Gm-Message-State: AD7BkJKddXjGqptDZXG7wsWMvvamfHr9gkdo/MN2YORd6Z685+CMvBn/c39XPB/LVQFzXg==
X-Received: by 10.28.34.67 with SMTP id i64mr6925949wmi.85.1459106638757;
	Sun, 27 Mar 2016 12:23:58 -0700 (PDT)
Received: from [192.168.0.11] (ip5f5ac842.dynamic.kabel-deutschland.de.
	[95.90.200.66]) by smtp.googlemail.com with ESMTPSA id
	s66sm7006743wmb.6.2016.03.27.12.23.57
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 27 Mar 2016 12:23:58 -0700 (PDT)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
To: Aharon Robbins <arnold@skeeve.com>
References: <20160306182857.GA27654@smok.internal>
	<201603061917.u26JHNwQ006986@skeeve.com>
	<56DC8AFB.80708@googlemail.com> <56E5920F.2090204@googlemail.com>
	<201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
	<201603140336.u2E3aR24017398@freefriends.org>
	<201603140356.u2E3umxW009438@skeeve.com>
	<20160314173208.GA31194@smok.internal>
	<56E6F8F9.5010908@googlemail.com>
	<20160314181753.GA30914@ti129.telemetry-investments.com>
	<56EF0442.3050605@googlemail.com>
	<201603210354.u2L3swdW016469@skeeve.com>
Message-ID: <56F8334C.70808@googlemail.com>
Date: Sun, 27 Mar 2016 21:23:56 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.7.0
MIME-Version: 1.0
In-Reply-To: <201603210354.u2L3swdW016469@skeeve.com>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::242
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 2102
Lines: 50

Am 21.03.2016 um 04:54 schrieb Aharon Robbins:
> I don't have a problem with marking UDP as obsolete.

So we agree in this point. For the moment it may a good
idea to simply mention obsolescence of UDP in the doc.

> I would prefer to continue to be able to have both server and client
> on the TCP side.

Agreed, there are really interesting applications built upon
both of them.

> I would strongly prefer to do this in a way that doesn't break old
> programs using TCP.

Agreed, of course.

> One thing that bothers me right now is that getaddrinfo() returns
> a linked list of struct addrinfo, and the gawk paradigm assumes that
> /inet/... will only map to one possible connection, an (IPv?, address, port)
> triple.  This should be dealt with reasonably in the case that more
> than one struct addrinfo comes back. (Probably a fatal error.)

That's right. But there are several ways of dealing with a list that
contains more the one entry. Some doc that I read suggests opening
connections for all of the available entries. Another possibility would be
to use the name (/inet or /inet4) as a hint that can be passed to the
getaddrinfo() system call. Instead of raising a fatal error (in case of
more than 1 entry) it could make sense to simply use the very first
entry.

> Andy and Juergen, feel free to work on a design and set up a separate
> branch off of master to work on this.

The working habbits of git are currently beyond my horizon
since I used SVN on a daily basis in several projects.
But working with patches in the usual "diff -u" format would be Ok.

> In the meantime, I have updated the doc based on one of Juergen's emails
> and pushed the changes to the repo.

Hmm, yes, inserting them as you did is probably a good idea.
Thanks for doing this.

> (As a side note, how did the original UDP client ever work? I have a vague
> memory of having tested it and that it did work... That also bothers me.)

I have thought about it for a while but have not come to
a convincing conclusion. Perhaps you tested only one
side (client or server) and simulated the other side with netcat.

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Mar 27 17:10:16 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id BE2C63E14
	for <schorr@schorr.telemetry-investments.com>; Sun, 27 Mar 2016 17:10:16 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id AC7F96A9; Sun, 27 Mar 2016 17:10:16 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 70682697
	for <aschorr@telemetry-investments.com>; Sun, 27 Mar 2016 17:10:15 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 70682697
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=gmail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=PfdWxm7H
Received: from localhost ([::1]:37428 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1akHwr-0006a6-MG
	for aschorr@telemetry-investments.com; Sun, 27 Mar 2016 17:10:13 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:33103)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1akHwp-0006a1-FV
	for gawk-devel@gnu.org; Sun, 27 Mar 2016 17:10:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1akHwl-0007U5-Fo
	for gawk-devel@gnu.org; Sun, 27 Mar 2016 17:10:11 -0400
Received: from mail-io0-x22b.google.com ([2607:f8b0:4001:c06::22b]:35159)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <michal.jnn@gmail.com>) id 1akHwl-0007Tu-B0
	for gawk-devel@gnu.org; Sun, 27 Mar 2016 17:10:07 -0400
Received: by mail-io0-x22b.google.com with SMTP id g185so3491774ioa.2
	for <gawk-devel@gnu.org>; Sun, 27 Mar 2016 14:10:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=date:from:to:cc:subject:message-id:references:mime-version
	:content-disposition:content-transfer-encoding:in-reply-to
	:user-agent; bh=/iODLLb8/6qOAaljk1snPcw+fhGS6eY0j0JKabydXnE=;
	b=PfdWxm7H7MWuJzGQnxDVlYP9U6i5MagiOQLhRcHd4nUVddELERzAz76cFp5jo9YckI
	iiFvsJv5BCQcKSZjZHNjJWF4SB8DqUE9yEXA0MyJu/E1fNloNSwZY4W+bj4YC332PLEu
	42i+tbFPngPyuQLTOI9a8LI3tRR3m31G+qNmaekAd54f9iGgj3rw30xTXPy/tpyN7X6A
	HHpbBUn1dkNO85gUfE1o3IMdsRTRE3MgMRrKKfD6cjTmmhvMVPs7lZnvhN2RQ73Trrlq
	OUas40EhsAom6WR8XKsL4eurVg8m2sm4pbIhGTwdgwr8XAlop3TyH5+oVSCLEXW++Mpm
	1Y0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:date:from:to:cc:subject:message-id:references
	:mime-version:content-disposition:content-transfer-encoding
	:in-reply-to:user-agent;
	bh=/iODLLb8/6qOAaljk1snPcw+fhGS6eY0j0JKabydXnE=;
	b=K1fhyxbu7/GZcChuzK+AsBUeYYJquPil2g9hZ/qc9r6Ci6i7UnSwvuoKVoAS89A973
	A+miFySMpytC0pQCloa+/lUQJT+YZZ1+hEiveKOgtfjV9V2PV7wc6AcajRe12je65BTU
	14btGqHrJNtuxMMadngBEXHTg9GkxeXWAqZjFbR8qiL5OjqGBEfP0K7tyK/pHqvcOAvV
	FT8JIFQa6c+oCcVom/8EXBiAptEz4/uBcFiMCYLUdmB1yzN8qxih8VdYTaFaVwOZWIyS
	m1wUeB5KZN35kfg13e03Guc2xz3QZ/8uzIb+CIPsi+hah/WR9IyaVtfTux8aWIf0CY7d
	S+/A==
X-Gm-Message-State: AD7BkJIUh3/p/MgF+QUZoouI0sfy6Fq0WNSfocDMArcWsoFHlWBUdQLqdY019CE2x4ykoQ==
X-Received: by 10.107.10.214 with SMTP id 83mr21688645iok.64.1459113006701;
	Sun, 27 Mar 2016 14:10:06 -0700 (PDT)
Received: from smok.internal (d23-17-121-177.abhsia.telus.net. [23.17.121.177])
	by smtp.gmail.com with ESMTPSA id d7sm2824495igg.18.2016.03.27.14.10.05
	(version=TLS1_2 cipher=AES128-SHA bits=128/128);
	Sun, 27 Mar 2016 14:10:06 -0700 (PDT)
Date: Sun, 27 Mar 2016 15:10:03 -0600
From: Michal Jaegermann <michal.jnn@gmail.com>
To: =?iso-8859-1?Q?J=FCrgen?= Kahrs <juergen.kahrs@googlemail.com>
Message-ID: <20160327211003.GA17748@smok.internal>
References: <201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
	<201603140336.u2E3aR24017398@freefriends.org>
	<201603140356.u2E3umxW009438@skeeve.com>
	<20160314173208.GA31194@smok.internal>
	<56E6F8F9.5010908@googlemail.com>
	<20160314181753.GA30914@ti129.telemetry-investments.com>
	<56EF0442.3050605@googlemail.com>
	<201603210354.u2L3swdW016469@skeeve.com>
	<56F8334C.70808@googlemail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <56F8334C.70808@googlemail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2607:f8b0:4001:c06::22b
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 1110
Lines: 24

On Sun, Mar 27, 2016 at 09:23:56PM +0200, Jürgen Kahrs wrote:
> Am 21.03.2016 um 04:54 schrieb Aharon Robbins:
> 
> > One thing that bothers me right now is that getaddrinfo() returns
> > a linked list of struct addrinfo, and the gawk paradigm assumes that
> > /inet/... will only map to one possible connection,

I do not see a contradiction here.  It is quite possible for one
connection to have multiple addresses.
....
> Instead of raising a fatal error (in case of
> more than 1 entry) it could make sense to simply use the very first
> entry.

I do not think that this will work in general.  Even discounting
multi-homed interfaces you should consider as a quite normal a situation
when you have on an interface an IPv4 address and IPv6 one.  If the
first entry happens to be on a network where you can get a connection
with the other machine then you are ok; otherwise you will get "not
reachable".  I do not see how one can avoid walking through that
linked list from getaddrinfo() while trying entries one by one and
returning an error only after all possibilities failed.  What do I miss?

   Michal

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Mon Mar 28 08:30:46 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id B96F18A
	for <schorr@schorr.telemetry-investments.com>; Mon, 28 Mar 2016 08:30:46 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id B126F69B; Mon, 28 Mar 2016 08:30:46 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 46F1C44C
	for <aschorr@telemetry-investments.com>; Mon, 28 Mar 2016 08:30:46 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 46F1C44C
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=skeeve.com
Received: from localhost ([::1]:40789 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1akWJg-0005nx-Lr
	for aschorr@telemetry-investments.com; Mon, 28 Mar 2016 08:30:44 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:38114)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1akWJY-0005mR-HK
	for gawk-devel@gnu.org; Mon, 28 Mar 2016 08:30:42 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1akWJV-0002vO-88
	for gawk-devel@gnu.org; Mon, 28 Mar 2016 08:30:36 -0400
Received: from freefriends.org ([96.88.95.60]:52668)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1akWJV-0002uN-09
	for gawk-devel@gnu.org; Mon, 28 Mar 2016 08:30:33 -0400
X-Envelope-From: arnold@skeeve.com
Received: from freefriends.org (localhost [127.0.0.1])
	by freefriends.org (8.14.9/8.14.9) with ESMTP id u2SCPP8t000831;
	Mon, 28 Mar 2016 06:25:25 -0600
Received: (from arnold@localhost)
	by freefriends.org (8.14.9/8.14.9/submit) id u2SCPOeP000830;
	Mon, 28 Mar 2016 12:25:24 GMT
From: arnold@skeeve.com
Message-Id: <201603281225.u2SCPOeP000830@freefriends.org>
X-Authentication-Warning: frenzy.freefriends.org: arnold set sender to
	arnold@skeeve.com using -f
Date: Mon, 28 Mar 2016 06:25:24 -0600
To: michal.jnn@gmail.com, juergen.kahrs@googlemail.com
References: <201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
	<201603140336.u2E3aR24017398@freefriends.org>
	<201603140356.u2E3umxW009438@skeeve.com>
	<20160314173208.GA31194@smok.internal>
	<56E6F8F9.5010908@googlemail.com>
	<20160314181753.GA30914@ti129.telemetry-investments.com>
	<56EF0442.3050605@googlemail.com>
	<201603210354.u2L3swdW016469@skeeve.com>
	<56F8334C.70808@googlemail.com> <20160327211003.GA17748@smok.internal>
In-Reply-To: <20160327211003.GA17748@smok.internal>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-Received-From: 96.88.95.60
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 324
Lines: 11

My main concern is what if more than one of the results from getaddrinfo
would work?  It makes no sense to associate multiple sockets with one
redirection.

I guess the thing to do is loop through the results and use the
first one that works, then skip the rest.  That's probably better than
a fatal error.

Thanks,

Arnold

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Apr  3 14:59:32 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id BE22C1D1
	for <schorr@schorr.telemetry-investments.com>; Sun,  3 Apr 2016 14:59:32 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id B55B96CC; Sun,  3 Apr 2016 14:59:32 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 6EE1C279
	for <aschorr@telemetry-investments.com>; Sun,  3 Apr 2016 14:59:32 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 6EE1C279
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=HOHRmMhj
Received: from localhost ([::1]:54843 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1amnFC-0007bE-LH
	for aschorr@telemetry-investments.com; Sun, 03 Apr 2016 14:59:30 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50245)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1amnFA-0007at-A5
	for gawk-devel@gnu.org; Sun, 03 Apr 2016 14:59:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1amnF5-0000Q0-GC
	for gawk-devel@gnu.org; Sun, 03 Apr 2016 14:59:28 -0400
Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]:34949)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1amnF5-0000Pw-2p
	for gawk-devel@gnu.org; Sun, 03 Apr 2016 14:59:23 -0400
Received: by mail-lf0-x235.google.com with SMTP id c126so21006742lfb.2
	for <gawk-devel@gnu.org>; Sun, 03 Apr 2016 11:59:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:references:cc:message-id:date:user-agent:mime-version
	:in-reply-to; bh=jymzw5+fgpC7Xi4deyYmr+qUyY4nyb1mppAeUXF+Aw8=;
	b=HOHRmMhjrxLnUVE/+OtfeKBypyvsrPyrPBIOMd5fuVbo1+vzN447Uts+WK4zqKfuhV
	j3ewEjTu9HJGYmUSo35gMIJy2EYKUxfR7PhDv7OO4gP05SEDx49VOa9WF7XGOSr5G41+
	Z1BopLZ0Xc4OfegQUryhhCIYztk9snznJLtcgiq+lU7b6jEYOgCvxcRS5f9PEph/2lJR
	Kq2bLJckNPRxpOR/zJ27xCjvfKkYXWw3vRrwKRWSvMDRQjz3EVbdXErcapdQ6g1AkoCN
	3BsW/FLwfK2+h95TqUTriz03s47qa3LQwGOT1Wl8XJSe9UhT86XAZoSf89vY99r6VZEJ
	kcLw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:references:cc:message-id:date
	:user-agent:mime-version:in-reply-to;
	bh=jymzw5+fgpC7Xi4deyYmr+qUyY4nyb1mppAeUXF+Aw8=;
	b=B2heQJ93aQ3zzmxM4de5kJzCk3WjR8wRsMPfI+Rz0BUEXUfDDQCGgS/r8+jmHowawa
	h07XBnPnDYJv5St10F9OV/Ppa0Byr27jgN7t4u6AOEk9bKM98SdS7eyVLyD4gfvlpAT8
	kQdHsoBR5nxgesiy4FX6tiCZTuI4OkF+W7kSJv7UkWFA4k0ZqnzGrTULwdhdeZs5O3yK
	97yKj/5PyfAOW4pBe5Anw4XQCi5jpyZMnIaCQ3kaTujWQoWbXYe+tH1szpISoOBqng9J
	lEYO1yz33v5LbEQ5z8ZTGdUbyfAlcjacfqBO7+pWafkZijVblUV+v1qqNBiUjD3G2Pn6
	QvSQ==
X-Gm-Message-State: AD7BkJLInubFPFh4UaSgzB21De6DYkVSjc9/2ljFUf0Crz9vBSuVEejYjSnS7eB50vkCfg==
X-Received: by 10.194.192.106 with SMTP id hf10mr724423wjc.134.1459709961797; 
	Sun, 03 Apr 2016 11:59:21 -0700 (PDT)
Received: from [192.168.0.11] (ip5f5ac887.dynamic.kabel-deutschland.de.
	[95.90.200.135]) by smtp.googlemail.com with ESMTPSA id
	m6sm25094147wje.21.2016.04.03.11.59.20 for <gawk-devel@gnu.org>
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 03 Apr 2016 11:59:21 -0700 (PDT)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
References: <201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
	<201603140336.u2E3aR24017398@freefriends.org>
	<201603140356.u2E3umxW009438@skeeve.com>
	<20160314173208.GA31194@smok.internal>
	<56E6F8F9.5010908@googlemail.com>
	<20160314181753.GA30914@ti129.telemetry-investments.com>
	<56EF0442.3050605@googlemail.com>
	<201603210354.u2L3swdW016469@skeeve.com>
	<56F8334C.70808@googlemail.com> <20160327211003.GA17748@smok.internal>
	<201603281225.u2SCPOeP000830@freefriends.org>
Cc: gawk-devel@gnu.org
Message-ID: <57016807.1050104@googlemail.com>
Date: Sun, 3 Apr 2016 20:59:19 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.7.0
MIME-Version: 1.0
In-Reply-To: <201603281225.u2SCPOeP000830@freefriends.org>
Content-Type: multipart/alternative;
	boundary="------------010504090001020009000105"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:4010:c07::235
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 6276
Lines: 142

This is a multi-part message in MIME format.
--------------010504090001020009000105
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit

Am 28.03.2016 um 14:25 schrieb arnold@skeeve.com:
> My main concern is what if more than one of the results from getaddrinfo
> would work?  It makes no sense to associate multiple sockets with one
> redirection.
>
> I guess the thing to do is loop through the results and use the
> first one that works, then skip the rest.  That's probably better than
> a fatal error.

I had a look at io.c socketopen.
It seems to do exactly what you suggested.
It even honours the "type" and the "family" of the
networking interface (IPV4/6 and TCP/UDP) that
can be deduced form the /inet path.
There are two nested "while" loops, the outer loop for the
local port and the inner loop for the remote port.
These nested loops try to open a connection for every
combination of local and remote port (taking into account
the hints/restrictions from /inet). Upon first successful
connection, both loops are left with the socket left open.
The loops go on looping as long as the connection
build-up is unsuccessful (or no combinations left to try).

The source code is a bit difficult to read because of
the "gotos", the nested "breaks" and the "returns".
But it looks clean and makes sense. Even the cleanup
with the freeaddrinfo() system call seems Ok.
Really not bad.


> One thing that bothers me right now is that getaddrinfo() returns
> a linked list of struct addrinfo, and the gawk paradigm assumes that
> /inet/... will only map to one possible connection, an (IPv?, address, port)
> triple.  This should be dealt with reasonably in the case that more
> than one struct addrinfo comes back. (Probably a fatal error.)

As mentioned above, the current behaviour looks fine to me.
But let me mention one side-effect that might confuse you
if you use "strace" to look at what the interpreter actually does.
When using the client and server example code, you will see
several socket() systems calls as the nested loops do their
work of trying all combinations. There is even one for SOCK_RAW.

    strace ./gawk -f client.awk 2>&1 | grep socket

    socket(PF_NETLINK, SOCK_RAW, 0)         = 3
    socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
    socket(PF_NETLINK, SOCK_RAW, 0)         = 3
    socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3

This is ugly, probably annoying, but not fatal.
What remains to be done is to remove the support for
UDP in io.c as well as in the doc and to improve the conceptual
description of TCP in the doc. Do we agree ?



--------------010504090001020009000105
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Am 28.03.2016 um 14:25 schrieb
      <a class="moz-txt-link-abbreviated" href="mailto:arnold@skeeve.com">arnold@skeeve.com</a>:<br>
    </div>
    <blockquote cite="mid:201603281225.u2SCPOeP000830@freefriends.org"
      type="cite">
      <pre wrap="">My main concern is what if more than one of the results from getaddrinfo
would work?  It makes no sense to associate multiple sockets with one
redirection.

I guess the thing to do is loop through the results and use the
first one that works, then skip the rest.  That's probably better than
a fatal error.
</pre>
    </blockquote>
    <br>
    I had a look at io.c socketopen.<br>
    It seems to do exactly what you suggested.<br>
    It even honours the "type" and the "family" of the<br>
    networking interface (IPV4/6 and TCP/UDP) that<br>
    can be deduced form the /inet path.<br>
    There are two nested "while" loops, the outer loop for the<br>
    local port and the inner loop for the remote port.<br>
    These nested loops try to open a connection for every<br>
    combination of local and remote port (taking into account<br>
    the hints/restrictions from /inet). Upon first successful<br>
    connection, both loops are left with the socket left open.<br>
    The loops go on looping as long as the connection<br>
    build-up is unsuccessful (or no combinations left to try).<br>
    <br>
    The source code is a bit difficult to read because of<br>
    the "gotos", the nested "breaks" and the "returns".<br>
    But it looks clean and makes sense. Even the cleanup<br>
    with the freeaddrinfo() system call seems Ok.<br>
    Really not bad.<br>
    <br>
    <br>
    <blockquote type="cite">
      <pre wrap="">One thing that bothers me right now is that getaddrinfo() returns
a linked list of struct addrinfo, and the gawk paradigm assumes that
<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>inet<span class="moz-txt-tag">/</span></i>... will only map to one possible connection, an (IPv?, address, port)
triple.  This should be dealt with reasonably in the case that more
than one struct addrinfo comes back. (Probably a fatal error.)
</pre>
    </blockquote>
    <br>
    As mentioned above, the current behaviour looks fine to me.<br>
    But let me mention one side-effect that might confuse you<br>
    if you use "strace" to look at what the interpreter actually does.<br>
    When using the client and server example code, you will see<br>
    several socket() systems calls as the nested loops do their<br>
    work of trying all combinations. There is even one for SOCK_RAW.<br>
    <blockquote><tt>strace ./gawk -f client.awk 2&gt;&amp;1 | grep
        socket<br>
        <br>
      </tt><tt></tt><tt>socket(PF_NETLINK, SOCK_RAW, 0)         = 3</tt><tt><br>
      </tt><tt>socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK,
        0) = 3</tt><tt><br>
      </tt><tt>socket(PF_NETLINK, SOCK_RAW, 0)         = 3</tt><tt><br>
      </tt><tt>socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 3</tt><tt><br>
      </tt></blockquote>
    This is ugly, probably annoying, but not fatal.<br>
    What remains to be done is to remove the support for<br>
    UDP in io.c as well as in the doc and to improve the conceptual<br>
    description of TCP in the doc. Do we agree ?<br>
    <br>
    <br>
  </body>
</html>

--------------010504090001020009000105--

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Apr  3 22:53:51 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 3276F20C
	for <schorr@schorr.telemetry-investments.com>; Sun,  3 Apr 2016 22:53:51 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 202BE6CC; Sun,  3 Apr 2016 22:53:51 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 8E8F9577
	for <aschorr@telemetry-investments.com>; Sun,  3 Apr 2016 22:53:50 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 8E8F9577
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=skeeve.com
Received: from localhost ([::1]:56223 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1amueC-00013e-LC
	for aschorr@telemetry-investments.com; Sun, 03 Apr 2016 22:53:48 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35230)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1amue9-00013V-DI
	for gawk-devel@gnu.org; Sun, 03 Apr 2016 22:53:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1amue5-0007wE-CR
	for gawk-devel@gnu.org; Sun, 03 Apr 2016 22:53:45 -0400
Received: from mxout2.netvision.net.il ([194.90.9.21]:55275)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <arnold@skeeve.com>) id 1amue5-0007vu-4i
	for gawk-devel@gnu.org; Sun, 03 Apr 2016 22:53:41 -0400
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; CHARSET=US-ASCII
Received: from skeeve.com ([93.173.16.221]) by mxout2.netvision.net.il
	(Oracle Communications Messaging Server 7.0.5.30.0 64bit (built Oct 22
	2013)) with ESMTPSA id <0O5300K799DBVS50@mxout2.netvision.net.il> for
	gawk-devel@gnu.org; Mon, 04 Apr 2016 05:53:35 +0300 (IDT)
Received: from skeeve.com (skeeve.com [127.0.0.1])
	by skeeve.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id
	u342rZO7003330; Mon, 4 Apr 2016 05:53:35 +0300
Received: (from arnold@localhost)	by skeeve.com (8.14.4/8.14.4/Submit)
	id u342rYxg003329;	Mon, 4 Apr 2016 05:53:34 +0300
From: Aharon Robbins <arnold@skeeve.com>
Message-id: <201604040253.u342rYxg003329@skeeve.com>
Date: Mon, 04 Apr 2016 05:53:34 +0300
To: juergen.kahrs@googlemail.com
References: <201603131938.u2DJc9jP009589@skeeve.com>
	<56E5C6C4.9000605@googlemail.com>
	<201603140336.u2E3aR24017398@freefriends.org>
	<201603140356.u2E3umxW009438@skeeve.com>
	<20160314173208.GA31194@smok.internal>
	<56E6F8F9.5010908@googlemail.com>
	<20160314181753.GA30914@ti129.telemetry-investments.com>
	<56EF0442.3050605@googlemail.com>
	<201603210354.u2L3swdW016469@skeeve.com>
	<56F8334C.70808@googlemail.com> <20160327211003.GA17748@smok.internal>
	<201603281225.u2SCPOeP000830@freefriends.org>
	<57016807.1050104@googlemail.com>
In-reply-to: <57016807.1050104@googlemail.com>
User-Agent: Heirloom mailx 12.5 6/20/10
X-detected-operating-system: by eggs.gnu.org: Solaris 10
X-Received-From: 194.90.9.21
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work?
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
X-Status: A
Content-Length: 1273
Lines: 44

Hi Juergen.

Thanks for the update. I'm glad the code is actually in reasonable shape.

I set up a git branch for you to work in. It's not all that hard.
You pretty much want to work as follows:

	cd /path/to/your/copy/of/the/repo
	make distclean
	git pull
	git checkout feature/improve-inet
	# code, compile, test, fix doc
	git add <list of changed files>
	git commit
	git push	# when there's something for everyone else to see
	# continue with "code, git add, git commit, git push" until done

Every once in a while, you will want to bring the branch up to date
with master.  This isn't hard.  First, be sure you have no unsaved changes.
Then:

	make distclean
	git checkout master && git pull	# bring up to date
	git checkout feature/improve-inet
	git merge master
	# Resolve any conflicts here. gvim or Emacs or ...
	# git add <resolved files>
	# git commit
	git push

That's really all there is to it.

You will want to have up to date versions of the various tools, as
listed in the NEWS file, including makeinfo.

Andy - please coordinate with Juergen too if you have what to contribute.

Starting by obsoleting /inet/udp is a good idea.  When that's ready
it can be merged to master and then y'all can start on the reworking
that Andy wants to do.

Thanks!

Arnold

From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Mon Apr  4 09:27:48 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 4D9623C0
	for <schorr@schorr.telemetry-investments.com>; Mon,  4 Apr 2016 09:27:48 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 465476C9; Mon,  4 Apr 2016 09:27:48 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 0ADE32AE
	for <aschorr@telemetry-investments.com>; Mon,  4 Apr 2016 09:27:47 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 0ADE32AE
Authentication-Results: sv3.telemetry-investments.com; dmarc=none header.from=telemetry-investments.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=fail reason="key not found in DNS" (0-bit key) header.d=telemetry-investments.com header.i=@telemetry-investments.com header.b=2FDQeCmz
Received: from localhost ([::1]:58623 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1an4Xh-0003dL-S8
	for aschorr@telemetry-investments.com; Mon, 04 Apr 2016 09:27:45 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54244)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1an4Xe-0003dF-OF
	for gawk-devel@gnu.org; Mon, 04 Apr 2016 09:27:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1an4Xb-0004hH-IC
	for gawk-devel@gnu.org; Mon, 04 Apr 2016 09:27:42 -0400
Received: from gw3a.telemetry-investments.com ([38.76.0.51]:51669
	helo=sv3.telemetry-investments.com)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <aschorr@telemetry-investments.com>)
	id 1an4Xb-0004gt-EO
	for gawk-devel@gnu.org; Mon, 04 Apr 2016 09:27:39 -0400
Received: from ti129.telemetry-investments.com (ti129 [192.168.53.129])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id C51C344C;
	Mon,  4 Apr 2016 09:27:36 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=telemetry-investments.com; s=tele1409; t=1459776457;
	bh=mX0+xH7BDTKMcWohU6wOtNj7nVpvVNl0VyjR1xNjpvQ=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=2FDQeCmzx9XKIZnj96BbW4CsCCyu8PiH4Dc/q+o/bxIkjbW+xRw4rg3Nm97Z01Bor
	G7DjW4Gxr7kJEiPIODkCJ9xkvebZkCldibwo0AuT62D2+c+b2goZPmya3CukHFocJv
	n1CDqwESISPJqwY6S1JOcE440/Hq0tP5tVZiHvZs=
Received: by ti129.telemetry-investments.com (Postfix, from userid 300)
	id 9AF723E0D; Mon,  4 Apr 2016 09:27:36 -0400 (EDT)
Date: Mon, 4 Apr 2016 09:27:36 -0400
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
To: Aharon Robbins <arnold@skeeve.com>
Message-ID: <20160404132736.GA26934@ti129.telemetry-investments.com>
References: <20160314173208.GA31194@smok.internal>
	<56E6F8F9.5010908@googlemail.com>
	<20160314181753.GA30914@ti129.telemetry-investments.com>
	<56EF0442.3050605@googlemail.com>
	<201603210354.u2L3swdW016469@skeeve.com>
	<56F8334C.70808@googlemail.com>
	<20160327211003.GA17748@smok.internal>
	<201603281225.u2SCPOeP000830@freefriends.org>
	<57016807.1050104@googlemail.com>
	<201604040253.u342rYxg003329@skeeve.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <201604040253.u342rYxg003329@skeeve.com>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 38.76.0.51
Cc: gawk-devel@gnu.org
Subject: Re: [gawk-devel] UDP networking doesn't work (and some thoughts
 about TCP)
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 2783
Lines: 55

Hi,

> Andy - please coordinate with Juergen too if you have what to contribute.
> 
> Starting by obsoleting /inet/udp is a good idea.  When that's ready
> it can be merged to master and then y'all can start on the reworking
> that Andy wants to do.

Sorry for being AWOL. My day job takes all my attention lately.  I have no
particularly view on whether we should get rid of /inet/udp, but if we keep it,
we should try to make it work in a reasonable way. My main concern is with how
tcp works. The current approach does not support the notion of listening for
and accepting connections. This was done for the sake of simplicity and
consistency with the udp approach, but it ignores the fact that serving TCP
stream connections is conceptually quite different than responding to UDP
packets. From an old email I sent about this:

On Sun, Jun 30, 2013 at 05:19:24PM -0400, Andrew J. Schorr wrote:
> 3. The tcp server logic was designed to be single-threaded.  If you try to read
> input from a server socket, it waits for a client to connect, closes the
> listener socket, and then processes I/O from the newly connected socket.  If I
> could start over, I'd change the TCP server mechanism to work something like
> this:
> 
>    server = "/inet/tcp/8080/0/0"
>    while (1) {
>       # wait for a client to connect
>       server |& getline client
>       # at this point, client contains the handle for the connected socket,
>       # something like "/inet/tcp/8080/client-host/client-port", and the server
>       # socket should still be open to accept new connections!
>       while ((client |& getline x) > 0)
> 	 printf "client %s says: %s\n", client, x
>       close(client)
>    }
> 
> If it had been done that way, it would be easy to use the new select
> multiplexing mechanisms to service multiple connected clients at once.
> Since it was not designed that way, I'm not sure how best to remedy this.
> I guess we can add a function to open a socket to listen for connections,
> and another to accept connections, but it may be painful to integrate this
> into the existing socket I/O scheme.  A separate BSD-style API would be
> easy to implement, but it seems suboptimal to have 2 different approaches
> to networking.  Does anbody have any thoughts on how best to solve this?

So if your goal is to retain compatibility with the existing TCP
server design, then I'm not sure I have much to contribute. I guess another
possibility would be to have a command-line option or environment option
to control the TCP behavior to support both approaches. I think that
the existing single-threaded TCP server implementation is too limited to
be useful, so that's why I suspect that nobody is using it. It's fine for
a simple demo, but how is it actually useful?

Regards,
Andy

From arnold@skeeve.com Mon Apr  4 15:55:03 2016
Return-Path: <arnold@skeeve.com>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
 ti9.telemetry-investments.com
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=10.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW
 autolearn=ham autolearn_force=no version=3.4.0
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
 by ti129.telemetry-investments.com (Postfix) with ESMTP id 7006420C
 for <schorr@schorr.telemetry-investments.com>;
 Mon,  4 Apr 2016 15:55:03 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
 id 670E6679; Mon,  4 Apr 2016 15:55:03 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from mxout2.netvision.net.il (mxout2.netvision.net.il [194.90.9.21])
 by sv3.telemetry-investments.com (Postfix) with ESMTP id 1085135A
 for <aschorr@telemetry-investments.com>; Mon,  4 Apr 2016 15:55:02 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 1085135A
Authentication-Results: sv3.telemetry-investments.com;
 dmarc=none header.from=skeeve.com
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain; CHARSET=US-ASCII
Received: from skeeve.com ([93.173.16.221]) by mxout2.netvision.net.il
 (Oracle Communications Messaging Server 7.0.5.30.0 64bit (built Oct 22 2013))
 with ESMTPSA id <0O5400KPJKNNHLB0@mxout2.netvision.net.il> for
 aschorr@telemetry-investments.com; Mon, 04 Apr 2016 22:55:00 +0300 (IDT)
Received: from skeeve.com (skeeve.com [127.0.0.1])
 by skeeve.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id u34JsxOx003565; 
 Mon, 4 Apr 2016 22:54:59 +0300
Received: (from arnold@localhost)	by skeeve.com (8.14.4/8.14.4/Submit)
 id u34JswLO003564;	Mon, 4 Apr 2016 22:54:58 +0300
From: Aharon Robbins <arnold@skeeve.com>
Message-id: <201604041954.u34JswLO003564@skeeve.com>
Date: Mon, 04 Apr 2016 22:54:58 +0300
To: aschorr@telemetry-investments.com, arnold@skeeve.com
Subject: Re: [gawk-devel] UDP networking doesn't work (and some thoughts about
 TCP)
Cc: juergen.kahrs@googlemail.com, gawk-devel@gnu.org
References: <20160314173208.GA31194@smok.internal>
 <56E6F8F9.5010908@googlemail.com>
 <20160314181753.GA30914@ti129.telemetry-investments.com>
 <56EF0442.3050605@googlemail.com> <201603210354.u2L3swdW016469@skeeve.com>
 <56F8334C.70808@googlemail.com> <20160327211003.GA17748@smok.internal>
 <201603281225.u2SCPOeP000830@freefriends.org>
 <57016807.1050104@googlemail.com> <201604040253.u342rYxg003329@skeeve.com>
 <20160404132736.GA26934@ti129.telemetry-investments.com>
In-reply-to: <20160404132736.GA26934@ti129.telemetry-investments.com>
User-Agent: Heirloom mailx 12.5 6/20/10
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: None (sv3.telemetry-investments.com: domain of arnold@skeeve.com
 does not designate permitted sender hosts)
 receiver=sv3.telemetry-investments.com; client-ip=194.90.9.21;
 envelope-from=<arnold@skeeve.com>; helo=mxout2.netvision.net.il;
X-Spambayes-Classification: ham; 0.00
Status: RO
Content-Length: 2893
Lines: 69

Hi Andy.

> My main concern is with how
> tcp works. The current approach does not support the notion of listening for
> and accepting connections. This was done for the sake of simplicity and
> consistency with the udp approach, but it ignores the fact that serving TCP
> stream connections is conceptually quite different than responding to UDP
> packets. From an old email I sent about this:
>
> On Sun, Jun 30, 2013 at 05:19:24PM -0400, Andrew J. Schorr wrote:
> > 3. The tcp server logic was designed to be single-threaded.  If you try to read
> > input from a server socket, it waits for a client to connect, closes the
> > listener socket, and then processes I/O from the newly connected socket.  If I
> > could start over, I'd change the TCP server mechanism to work something like
> > this:
> > 
> >    server = "/inet/tcp/8080/0/0"
> >    while (1) {
> >       # wait for a client to connect
> >       server |& getline client
> >       # at this point, client contains the handle for the connected socket,
> >       # something like "/inet/tcp/8080/client-host/client-port", and the server
> >       # socket should still be open to accept new connections!
> >       while ((client |& getline x) > 0)
> > 	 printf "client %s says: %s\n", client, x
> >       close(client)
> >    }
> > 
> > If it had been done that way, it would be easy to use the new select
> > multiplexing mechanisms to service multiple connected clients at once.
> > Since it was not designed that way, I'm not sure how best to remedy this.
> > I guess we can add a function to open a socket to listen for connections,
> > and another to accept connections, but it may be painful to integrate this
> > into the existing socket I/O scheme.  A separate BSD-style API would be
> > easy to implement, but it seems suboptimal to have 2 different approaches
> > to networking.  Does anbody have any thoughts on how best to solve this?
>
> So if your goal is to retain compatibility with the existing TCP
> server design, then I'm not sure I have much to contribute.

I think this is actually rather easy to solve, by introducing
a new namespace:

    server = "/inetserv/tcp/8080/0/0"
    while (1) {
       # wait for a client to connect
       getline client < server
       # at this point, client contains the handle for the connected socket,
       # something like "/inet/tcp/8080/client-host/client-port", and the server
       # socket should still be open to accept new connections!
       while ((client |& getline x) > 0)
 	 printf "client %s says: %s\n", client, x
       close(client)
    }
    close(server)

To read handles it's better (IMHO) to use a < redirection, since
it's a one way communication.

In terms of plans, let's use the new branch to remove UDP. Once that's
merged into master, we can use it for further standalone experimentation
until everyone is happy.

Thoughts?

Thanks,

Arnold


From gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org  Sun Apr 10 18:46:09 2016
Return-Path: <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-Original-To: schorr@schorr.telemetry-investments.com
Delivered-To: schorr@schorr.telemetry-investments.com
Received: from sv3.telemetry-investments.com (ti74 [192.168.58.74])
	by ti129.telemetry-investments.com (Postfix) with ESMTP id 7887D2B2
	for <schorr@schorr.telemetry-investments.com>; Sun, 10 Apr 2016 18:46:09 -0400 (EDT)
Received: by sv3.telemetry-investments.com (Postfix)
	id 664E169E; Sun, 10 Apr 2016 18:46:09 -0400 (EDT)
Delivered-To: aschorr@telemetry-investments.com
Received: from lists.gnu.org (lists.gnu.org [208.118.235.17])
	by sv3.telemetry-investments.com (Postfix) with ESMTP id 060592D7
	for <aschorr@telemetry-investments.com>; Sun, 10 Apr 2016 18:46:08 -0400 (EDT)
DMARC-Filter: OpenDMARC Filter v1.3.1 sv3.telemetry-investments.com 060592D7
Authentication-Results: sv3.telemetry-investments.com; dmarc=pass header.from=googlemail.com
Authentication-Results: sv3.telemetry-investments.com;
	dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.b=aTQiSxDP
Received: from localhost ([::1]:36889 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>)
	id 1apO7M-0002T2-6C
	for aschorr@telemetry-investments.com; Sun, 10 Apr 2016 18:46:08 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:51154)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1apO7J-0002R3-Gl
	for gawk-devel@gnu.org; Sun, 10 Apr 2016 18:46:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1apO7F-0004Qw-Hc
	for gawk-devel@gnu.org; Sun, 10 Apr 2016 18:46:05 -0400
Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36088)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <juergen.kahrs@googlemail.com>) id 1apO7F-0004Qo-As
	for gawk-devel@gnu.org; Sun, 10 Apr 2016 18:46:01 -0400
Received: by mail-wm0-x244.google.com with SMTP id l6so17394391wml.3
	for <gawk-devel@gnu.org>; Sun, 10 Apr 2016 15:46:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=googlemail.com; s=20120113;
	h=from:subject:references:cc:message-id:date:user-agent:mime-version
	:in-reply-to:content-transfer-encoding;
	bh=VkLJf1sHk+OHjE9jns5+CXEDvxb0njer6a/EoiBLmSM=;
	b=aTQiSxDP+WVbYOEaZI2cY0GAUnASPjRMBOjNa/SetAbjszzsn3hthpx3Avte4URdpa
	ANS46fhFohKpj1RDo9xULP5A+o1qxRfv2FdpeZ0yHRGXOzEOy3AET3opMNfAm7TpLvEl
	zWZlOZ3Z1aluEGlfz1P0obD609sI9a8AxQ+CoWykZMA3DwSOYIzb6MyG2FKl0POTPn4a
	Qew9g0733I3i27V7OUTRGe5KKbDSlgfmV88apM9llvUjrjb8PQN7V7rJN6q07rEg7gHz
	MF/qu6vkLCIFVyj5yhFsUTb0UaHGCzbO5pxyWvwWnPO5xSyoRDFFBalDPfhzFyoag+1K
	6Wcg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20130820;
	h=x-gm-message-state:from:subject:references:cc:message-id:date
	:user-agent:mime-version:in-reply-to:content-transfer-encoding;
	bh=VkLJf1sHk+OHjE9jns5+CXEDvxb0njer6a/EoiBLmSM=;
	b=F1LxtAST2fPG9Buv+iVNdi4y7ZGcgwJGSVzcVPSVjnOKya0XGuJnTDQ9fr6FHDtTmR
	Ycb+N1QGIGfNHCusa+Ehjk9TzG/acOMAGZ7d/JU98elS5Gl08812GWAw/9UrcihKHe8/
	QxVDDw2Gak95t4PTtcZfRwR4jLbMjlvc/7KPXnBephrxRJL+c+BcV1llnaIBuT3VLHS4
	5VDx25otV3JSFMbT6vADnW8VmZ302qBhkML/4xV4aTQJPrhYdihUq9+joUNpNZyP+4jN
	aQGQx9LMIPTshVJ9/bvReWTzn82Ee7XC0gcH6FNSB+TcQylKMXQucb5v8a7wXMutL4Pm
	ydzQ==
X-Gm-Message-State: AD7BkJJdClPPZPXynqHXiriIe///0m2VkMapnhQOs2qWCEU0hKgHueCdtRi3a5NqxNFbbQ==
X-Received: by 10.194.142.196 with SMTP id ry4mr20040110wjb.171.1460328360324; 
	Sun, 10 Apr 2016 15:46:00 -0700 (PDT)
Received: from [192.168.0.11] (ip5f5ac83d.dynamic.kabel-deutschland.de.
	[95.90.200.61]) by smtp.googlemail.com with ESMTPSA id
	q62sm14309810wmg.12.2016.04.10.15.45.59 for <gawk-devel@gnu.org>
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 10 Apr 2016 15:45:59 -0700 (PDT)
From: "=?UTF-8?Q?J=c3=bcrgen_Kahrs?=" <juergen.kahrs@googlemail.com>
X-Google-Original-From: =?UTF-8?Q?J=c3=bcrgen_Kahrs?=
	<Juergen.Kahrs@googlemail.com>
References: <20160314173208.GA31194@smok.internal>
	<56E6F8F9.5010908@googlemail.com>
	<20160314181753.GA30914@ti129.telemetry-investments.com>
	<56EF0442.3050605@googlemail.com>
	<201603210354.u2L3swdW016469@skeeve.com>
	<56F8334C.70808@googlemail.com> <20160327211003.GA17748@smok.internal>
	<201603281225.u2SCPOeP000830@freefriends.org>
	<57016807.1050104@googlemail.com>
	<201604040253.u342rYxg003329@skeeve.com>
	<20160404132736.GA26934@ti129.telemetry-investments.com>
	<201604041954.u34JswLO003564@skeeve.com>
Cc: gawk-devel@gnu.org
Message-ID: <570AD7A6.1040800@googlemail.com>
Date: Mon, 11 Apr 2016 00:45:58 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
	Thunderbird/38.7.0
MIME-Version: 1.0
In-Reply-To: <201604041954.u34JswLO003564@skeeve.com>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2a00:1450:400c:c09::244
Subject: Re: [gawk-devel] UDP networking doesn't work (and some thoughts
 about TCP)
X-BeenThere: gawk-devel@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: "Internal discussion list for gawk development." <gawk-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/mailman/private/gawk-devel/>
List-Post: <mailto:gawk-devel@gnu.org>
List-Help: <mailto:gawk-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gawk-devel>,
	<mailto:gawk-devel-request@gnu.org?subject=subscribe>
Errors-To: gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
Sender: "gawk-devel"
	<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>
X-SPF-Scan-By: smf-spf v2.0.2 - http://smfs.sf.net/
Received-SPF: Pass (sv3.telemetry-investments.com: domain of gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org
	designates 208.118.235.17 as permitted sender)
	receiver=sv3.telemetry-investments.com; client-ip=208.118.235.17;
	envelope-from=<gawk-devel-bounces+aschorr=telemetry-investments.com@gnu.org>; helo=lists.gnu.org;
Status: RO
Content-Length: 1427
Lines: 31

Am 04.04.2016 um 21:54 schrieb Aharon Robbins:
> In terms of plans, let's use the new branch to remove UDP. Once that's
> merged into master, we can use it for further standalone experimentation
> until everyone is happy.
>
> Thoughts?

I think Andrew is right with his fundamental disagreement.
Andrew argued that the current TCP interface
- is too simple (it cannot support anything but the most basic
    kinds of applications)
- is incompatible with the new "select" multiplexing mechanisms
- could be replaced by a BSD-style API, perhaps under a
    different namespace (as suggested by Arnold)

This leads me to the following questions:
1) Should an improved API retain compatibility with the old TCP API ?
    Is the old TCP API worth the effort (is it such a good concept) ?
2) Should any alternative API be implemented inside GAWK ?
Anyone who wants to do serious work with TCP applications
will probably answer with "NO" to these questions.
ad 1: Stuffing parameters into an artificial path name helps
         with setting static parameters, but cannot help with the
         the dynamic behaviour (unforeseeable events and details)
         of networking connections
ad 2: A second networking API inside GAWK is indeed "suboptimal",
         unless there was a proven brilliant API that only needed to be
         taken over (I doubt there is)

Perhaps the best place for a networking API is a separate extension.