|
|
"Interrupted system call", read and socket
Hello,
I have a server application and a client one which communicate with
sockets and SSH tunneling (ssh -N -f -L8888:localhost:3333
user@localhost). I have to use ssh tunneling because of firewalls.
My problem is that the read in the client has the "Interrupted system
call" error even if I put this
while(-1==(nr=read(DIST,ptr,nl)))
{
if(errno!=EINTR)
break;
}
and it appears randomly.
If I do not use ssh tunneling, it works.
If someone has an idea ...
Thanks,
Karim.
|
|
0
|
|
|
|
Reply
|
karim
|
1/9/2004 7:19:20 PM |
|
karim bernardet wrote:
> Hello,
>
> I have a server application and a client one which communicate with
> sockets and SSH tunneling (ssh -N -f -L8888:localhost:3333
> user@localhost). I have to use ssh tunneling because of firewalls.
>
> My problem is that the read in the client has the "Interrupted system
> call" error even if I put this
> while(-1==(nr=read(DIST,ptr,nl)))
> {
> if(errno!=EINTR)
> break;
> }
>
> and it appears randomly.
>
> If I do not use ssh tunneling, it works.
>
> If someone has an idea ...
>
> Thanks,
>
> Karim.
No idea.
Typically, you will receive this error when the syscall blocks and a signal
is delivered.
However why bother, just resume read().
E.g.:
int readn(int fd, void* data, size_t size)
{
for (;;) {
ssize_t n = read(fd, data, size);
if (n == -1) {
if (errno == EINTR)
continue; // Resume.
return errno;
}
if (!(size -= n))
return 0;
data = (char*)data + n;
}
}
/FAU
|
|
0
|
|
|
|
Reply
|
Frank
|
1/10/2004 9:29:50 AM
|
|
Hello Karim,
> > I have a server application and a client one which communicate with
> > sockets and SSH tunneling (ssh -N -f -L8888:localhost:3333
> > user@localhost). I have to use ssh tunneling because of firewalls.
> >
> > My problem is that the read in the client has the "Interrupted system
> > call" error even if I put this
> > while(-1==(nr=read(DIST,ptr,nl)))
> > {
> > if(errno!=EINTR)
> > break;
> > }
> >
> > and it appears randomly.
So basically, you resume the read() and you still get an "Interrupted
system call"?
Whether your loop construct is wrong (doesn't look like to me. Though
I prefer Frank's construct which is somewhat nicier to read)...
Or it's not the read() call that got interrupted...
Regards,
Loic.
|
|
0
|
|
|
|
Reply
|
loic
|
1/11/2004 3:22:25 PM
|
|
|
2 Replies
996 Views
(page loaded in 0.103 seconds)
Similiar Articles: "Interrupted system call", read and socket - comp.unix.programmer ..."Interrupted system call", read and socket - comp.unix.programmer ... Interrupted System Call - EINTR - Waikato Linux Users Group Interrupted System Call. Interrupted system calls (socket read) , EINTR and SIGTERM - comp ...Hi All, I have a scenario like this Function 1 { Send a message Wait for the reply for that message in a while(1) loop } F... [ANN] Youseful TAP PLUGIN - comp.databases.filemaker"Interrupted system call", read and socket - comp.unix.programmer ... [ANN] Youseful TAP PLUGIN - comp.databases.filemaker... uses for the Youseful TAPI plug-in: - log all ... TAPI Plug-in for Filemaker - comp.databases.filemakerMy company is looking for a TAPI plug-in that will enable us to look up and retrieve the customer record from Filemaker when they call into our call c... C++ wrapper for async socket calls. - comp.unix.programmer ...This is for simple username/password entry (it's a PAM conversation wrapper ... "Interrupted system call", read and socket - comp.unix ... Can I use a sigalrm signal to ... Illegal seek in Unix Domain Socket - comp.unix.programmer ...If you must call other functions before calling perror(), you ... Unix & Linux: Illegal seek in Unix Domain Socket - programming ... shows that it is reading/writing from/to ... Sockets in gfortran? - comp.lang.fortran"Interrupted system call", read and socket - comp.unix.programmer ... Sockets in gfortran? - comp.lang.fortran "Interrupted system call", read and socket - comp.unix ... socket lock in multithred programming - comp.unix.programmer ...Interrupted system calls (socket read) , EINTR and SIGTERM programming.itags.org ... read() call by SIGALRM in multithreaded ... Interrupted system calls (socket read ... readline() with select() on STDIN - comp.unix.programmer ..."Interrupted system call", read and socket - comp.unix.programmer ... readline() with select() on STDIN - comp.unix.programmer ..... that needs to monitor different sockets ... socket in use ? - comp.protocols.time.ntp"Interrupted system call", read and socket - comp.unix.programmer ... Hello, I have a server application and a client one which communicate with sockets and SSH tunneling ... Unix connect() and interrupted system calls - www.madore.org... the semantics of the Unix connect() system call when interrupted ... people's opinion as to how they read the ... the whole point of using blocking sockets is for system calls to ... "Interrupted system call", read and socket - comp.unix.programmer ..."Interrupted system call", read and socket - comp.unix.programmer ... Interrupted System Call - EINTR - Waikato Linux Users Group Interrupted System Call. 7/23/2012 12:56:35 PM
|
|
|
|
|
|
|
|
|