- udp := uppercase(proto) = 'UDP';\r
- if udp then a := SOCK_DGRAM else a := SOCK_STREAM;\r
- a := Socket(inaddr.inaddr.family,a,0);\r
+\r
+ udp := false;\r
+ if (uppercase(proto) = 'UDP') then begin\r
+ b := IPPROTO_UDP;\r
+ a := SOCK_DGRAM;\r
+ udp := true;\r
+ dgram := true;\r
+ end else if (uppercase(proto) = 'TCP') or (uppercase(proto) = '') then begin\r
+ b := IPPROTO_TCP;\r
+ a := SOCK_STREAM;\r
+ dgram := false;\r
+ end else if (uppercase(proto) = 'ICMP') or (strtointdef(proto,256) < 256) then begin\r
+ b := strtointdef(proto,IPPROTO_ICMP);\r
+ a := SOCK_RAW;\r
+ dgram := true;\r
+ end else begin\r
+ raise ESocketException.create('unrecognised protocol');\r
+ end;\r
+\r
+ a := Socket(inaddr.inaddr.family,a,b);\r