program Unix_Client; uses sockets,inet; const port = 4456; { port serveru } var s : longint; { socket } sin,sout : text; { pascalske proudy } line : string; addr : TInetSockAddr; { struktura pro connect } host : THost; { objekt hostitele (coz zni hrozne ucene ^_~) } begin if paramcount<>1 then begin writeln('Usage: ',paramstr(0),'
'); halt(4) end; s:=socket(AF_INET,SOCK_STREAM,0); if s=-1 then begin halt(1); end; host.NameLookup(paramstr(1)); addr.family:=AF_INET; { Rodina adres, tj AF_INET } addr.port:=ShortHostToNet(port); addr.addr:=HostToNet(LongInt(host.IPAddress)); { IP adresa serveru } host.done; if not connect(s,addr,sin,sout) then halt(2); reset(sin); rewrite(sout); repeat readln(sin,line); writeln(line); readln(line); if (line='') then break; writeln(sout,line) until false; close(sin); close(sout); end.