# Socket#read raising Errno::EINTR

**URL:** <https://www.ruby-forum.com/t/socket-read-raising-errno-eintr/164902>\
**Category:** Ruby\
**Created:** [April 7, 2009, 8:48am UTC](https://www.ruby-forum.com/t/socket-read-raising-errno-eintr/164902 "2009-04-07T08:48:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [April 7, 2009, 8:48am UTC](https://www.ruby-forum.com/t/socket-read-raising-errno-eintr/164902/1 "2009-04-07T08:48:27Z")

</div>

Hello all,

I’ve got some socket code that is causing me some headaches. I create a  
socket, write to it, then wait for the server to respond back. See  
below:

@conn = TCPSocket.new(@host,@port)  
@conn.write(some\_string)  
@conn.read(7) \<-- I always expect the server to return 7 bytes of data  
back

When I get to @conn.read(7), it throws an Errno::EINTR - ‘Interrupted  
system call’ exception. Anyone know what’s causing this?!

–  
Thanks!  
Bryan

---

<div class="post-metadata">

**Author:** ![roxah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/54ee81/32.png) [@roxah](https://www.ruby-forum.com/u/roxah)\
**Post date:** [April 7, 2009, 9:23am UTC](https://www.ruby-forum.com/t/socket-read-raising-errno-eintr/164902/2 "2009-04-07T09:23:57Z")

</div>

Bryan R. wrote:

> Hello all,
> 
> I’ve got some socket code that is causing me some headaches. I create a  
> socket, write to it, then wait for the server to respond back. See  
> below:
> 
> @conn = TCPSocket.new(@host,@port)  
> @conn.write(some\_string)  
> @conn.read(7) \<-- I always expect the server to return 7 bytes of data  
> back
> 
> When I get to @conn.read(7), it throws an Errno::EINTR - ‘Interrupted  
> system call’ exception. Anyone know what’s causing this?!
> 
> –  
> Thanks!  
> Bryan

It works for me. Can u send your actual server and client program , so  
that I  
could help you.
