<html>
I have a problem reading a unix-socket <br>
<br>
this snippet (from www.lirc.org) works, but it's in perl ...........
:-(<br>
<br>
<tt>
fd=socket(AF_UNIX,SOCK_STREAM,0);<br>
if(fd==-1) {<br>
perror("socket");<br>
exit(errno);<br>
};<br>
if(connect(fd,(struct sockaddr
*)&addr,sizeof(addr))==-1) {<br>
perror("connect");<br>
exit(errno); <br>
};<br>
<br>
for(;;) {<br>
i=read(fd,buf,128);<br>
if(i==-1) {<br>
perror("read");<br>
exit(errno);<br>
};<br>
if(!i) exit(0);<br>
write(STDOUT_FILENO,buf,i);<br>
};
<br>
<br>
<br>
</tt><font size=3>What I would like is something like this :<br>
</font><tt>Program reading_socket;<br>
var<br>
data : string;<br>
begin<br>
repeat<br>
data:=read_socket('/dev/lircd');<br>
< do something with data here ><br>
until keypressed; (until I daemonize it)<br>
end.<br>
<br>
</tt><font size=3>Can anyone in here supply me with this ?</font>
<BR>
<div>Kenneth Due</div>
<br>
<div>kenneth@skummel.dk</div>
kenneth@computercafeen.dk
</html>