Question

Well.. it's pretty much that, I seem to be getting a "Illegal Seek" error when checking my errno variable. The problem is that I have no idea of what that can mean.

I know sockets are treated like files in unix, but I can't see how can this be related to sockets. What I'm doing exactly is:

int sck = ::accept(m_socket, (struct sockaddr*)&client_address, (socklen_t*)&address_len);

Then I get sck = -1 and errno = ESPIPE

And the weird thing is that it happens randomly. I mean, sometimes the code works fine, and sometimes it just thows an exception. I'm working with threads so that's understandable. But I just would like to know what kind of behaviour makes the accept() call to set errno as ESPIPE so I could check the paramethers for instance.

Thanks Nelson R. Pérez

Was it helpful?

Solution

The most probable cause is that the m_socket variable is being corrupted. Use strace as @Aidan suggests to see what value is being passed to accept(2), or attach a debugger to the process and set a watchpoint on that memory location.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top