Sorry about the 'spam'
I forgot to remove the html, before sending the mail..............

I have a problem reading a unix-socket 

this snippet (from www.lirc.org) works, but it's in perl (I think)
........... :-(

        fd=socket(AF_UNIX,SOCK_STREAM,0);
        if(fd==-1)  {
                perror("socket");
                exit(errno);
        };
        if(connect(fd,(struct sockaddr *)&addr,sizeof(addr))==-1)  {
                perror("connect");
                exit(errno);    
        };
        
        for(;;)  {
                i=read(fd,buf,128);
                if(i==-1)  {
                        perror("read");
                        exit(errno);
                };
                if(!i)  exit(0);
                write(STDOUT_FILENO,buf,i);
        };     


What I would like is something like this :

Program reading_socket;
var
  data : string;
begin
  repeat
   data:=read_socket('/dev/lircd');
   < do something with data here >
  until keypressed; (until I daemonize it)
end.

Can anyone in here supply me with this ? 
Kenneth Due

[EMAIL PROTECTED]
[EMAIL PROTECTED]

_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to