home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
soclose.zip
/
soclose.pas
< prev
Wrap
Pascal/Delphi Source File
|
2002-05-24
|
733b
|
45 lines
{$M 16384}
uses Inet, TpString;
var
sock : Longint;
rc : Longint;
procedure UsageExit;
begin
WriteLn('Usage: soclose Socket');
WriteLn;
Halt(20);
end;
begin
WriteLn('soclose, (c) 2002 by madded2.'#13#10);
if (ParamCount <> 1) or
not(Str2Long(ParamStr(1),sock)) then UsageExit;
rc:=sock_init;
if rc <> 0 then
begin
WriteLn('sock_init failed, rc=',sock_errno);
Halt(1);
end;
addsockettolist(sock);
rc:=soclose(sock);
if rc = 0 then
begin
WriteLn('Socket ',sock,' closed.');
Halt(0);
end else
begin
WriteLn('soclose failed, rc=',sock_errno);
Halt(2);
end;
end.