Question: I am simply trying to get the [listen gem](https://github.com/guard/listen) to work, and just tried the basic example in [the documentation](https://github.com/guard/listen#usage).

Here is what I just tried, with some info about my installation. I am running on CentOS.

```
$ uname -a
Linux www14405ue.sakura.ne.jp 2.6.32-279.2.1.el6.x86_64 #1 SMP Fri Jul 20 01:55:29 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
$ ruby --version
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
$ gem install listen
....
6 gems installed
$ gem list listen

*** LOCAL GEMS ***

listen (2.0.1)
$ mkdir foo
$ cd foo
$ mkdir bar
$ vim listen.rb
$ cat listen.rb
require 'listen'
listener = Listen.to('bar') do |modified, added, removed|
  puts "modified absolute path: #{modified}"
  puts "added absolute path: #{added}"
  puts "removed absolute path: #{removed}"
end
listener.start # not blocking
sleep
$ ruby listen.rb
$ echo "baz" > bar/baz   # from the same directory in another terminal
$ echo "qux" >> bar/baz  # a moment later 
$ rm bar/baz             # again a moment later

```

I would have expected some output for the two `echo` and the `rm` but I did not get anything. I tried to change the listen path from `bar` to `./bar` but this did not help either.

What am I missing here?

Answer: 
On Windows, if `accept()` fails, it returns `INVALID_SOCKET`, not `SOCKET_ERROR`.

The real problem is your `if()` statement is performing both assignment and comparison at the same time, but it is missing a required set of parenthesis for the assignment, so it is actually comparing a different value than you are expecting. Do this instead:

```
if( (sConnect = accept( sListen, (SOCKADDR*)&addr, &addrlen)) != INVALID_SOCKET )

```

A better option is to separate the assignment and the comparison:

```
sConnect = accept( sListen, (SOCKADDR*)&addr, &addrlen);
if( sConnect != INVALID_SOCKET )  

```
Try this:

```
sConnect = accept( sListen, (SOCKADDR*)&addr, &addrlen);
if( sConnect  != INVALID_SOCKET)

```