# App fails on Windows, but works on OS X

**URL:** <https://www.ruby-forum.com/t/app-fails-on-windows-but-works-on-os-x/171679>\
**Category:** Ruby\
**Created:** [July 7, 2009, 3:54pm UTC](https://www.ruby-forum.com/t/app-fails-on-windows-but-works-on-os-x/171679 "2009-07-07T15:54:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![owossoborn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@owossoborn](https://www.ruby-forum.com/u/owossoborn)\
**Post date:** [July 7, 2009, 3:54pm UTC](https://www.ruby-forum.com/t/app-fails-on-windows-but-works-on-os-x/171679/1 "2009-07-07T15:54:10Z")

</div>

I’ve been working on a query app for Battlefield 2142 servers, and the  
following app always fails on some IPs in Windows:

[http://pastie.org/537069.txt](http://pastie.org/537069.txt)

The IPs it works on, it will always work on; the IPs it fails on, it  
will always fail on. I’ve left two sample IPs in the application. The IP  
that does not work on Windows has not ever worked, but I tried it on OS  
X and it worked flawlessly there despite both the mac and the windows  
machines being on the same network. I’ve tried it on three separate  
Windows machines (two on the same network, one in a data centre) with  
Windows Vista Ultimate 64 bit, Windows Vista 32 bit, Windows Server 2003  
32 bit. It failed on all three of those Windows systems.

Both the mac and the Windows machine are running Ruby 1.8.6. Anyone able  
to help me understand what might account for the problems in Windows?

Thanks for any assistance!

---

<div class="post-metadata">

**Author:** ![owossoborn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@owossoborn](https://www.ruby-forum.com/u/owossoborn)\
**Post date:** [July 7, 2009, 7:44pm UTC](https://www.ruby-forum.com/t/app-fails-on-windows-but-works-on-os-x/171679/2 "2009-07-07T19:44:10Z")

</div>

Randy G. wrote:

> I’ve been working on a query app for Battlefield 2142 servers, and the  
> following app always fails on some IPs in Windows:

Sounds suspiciously like a networking issue – firewall, port conflict,  
something of that nature where the machines that fail, have different  
settings or environment. Maybe the internal software firewall of those  
machines?

– gw

---

<div class="post-metadata">

**Author:** ![owossoborn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@owossoborn](https://www.ruby-forum.com/u/owossoborn)\
**Post date:** [July 7, 2009, 8:00pm UTC](https://www.ruby-forum.com/t/app-fails-on-windows-but-works-on-os-x/171679/3 "2009-07-07T20:00:37Z")

</div>

I wonder if it’s possible that there is a permissions issue where  
scripts don’t have sufficient permissions. I think windows makes a  
distinction between scripts and executables, and ruby is a script  
language.

I wonder what happens if you run a tool to convert the ruby app to an  
exe if it would still fail or maybe fail with some error message that  
might give a better clue about what is wrong

PS: I top post so folks don’t have to scroll through all the already  
read stuff, to see the reply.

* * *

From: Randy G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: ruby-talk ML [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Tuesday, July 7, 2009 10:54:41 AM  
Subject: Re: App fails on Windows, but works on OS X.

Greg W. wrote:

> Randy G. wrote:
> 
> > I’ve been working on a query app for Battlefield 2142 servers, and the  
> > following app always fails on some IPs in Windows:
> 
> Sounds suspiciously like a networking issue – firewall, port conflict,  
> something of that nature where the machines that fail, have different  
> settings or environment. Maybe the internal software firewall of those  
> machines?
> 
> – gw

Hi Greg,  
Thanks for responding.

The systems I tried were all on separate networks, two of them were on  
residential ISP networks (but different networks) and the last one was  
in a data centre. I don’t believe there’s any software firewalls on the  
machines that would block it, and the mac that was able to connect was  
behind the same network as one of those Windows machines that could not  
connect.

To add something even more peculiar, I have another app that sends out  
the exact same packets to 2142 servers (a windows based app coded in  
C++) and it has no problem receiving a response.

---

<div class="post-metadata">

**Author:** ![owossoborn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@owossoborn](https://www.ruby-forum.com/u/owossoborn)\
**Post date:** [July 7, 2009, 8:53pm UTC](https://www.ruby-forum.com/t/app-fails-on-windows-but-works-on-os-x/171679/4 "2009-07-07T20:53:17Z")

</div>

I gave that a shot after compiling the script using OCRA. Unfortunately  
it behaved he exact same way.

---

<div class="post-metadata">

**Author:** ![owossoborn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@owossoborn](https://www.ruby-forum.com/u/owossoborn)\
**Post date:** [July 7, 2009, 7:54pm UTC](https://www.ruby-forum.com/t/app-fails-on-windows-but-works-on-os-x/171679/5 "2009-07-07T19:54:35Z")

</div>

Greg W. wrote:

> Randy G. wrote:
> 
> > I’ve been working on a query app for Battlefield 2142 servers, and the  
> > following app always fails on some IPs in Windows:
> 
> Sounds suspiciously like a networking issue – firewall, port conflict,  
> something of that nature where the machines that fail, have different  
> settings or environment. Maybe the internal software firewall of those  
> machines?
> 
> – gw

Hi Greg,  
Thanks for responding.

The systems I tried were all on separate networks, two of them were on  
residential ISP networks (but different networks) and the last one was  
in a data centre. I don’t believe there’s any software firewalls on the  
machines that would block it, and the mac that was able to connect was  
behind the same network as one of those Windows machines that could not  
connect.

To add something even more peculiar, I have another app that sends out  
the exact same packets to 2142 servers (a windows based app coded in  
C++) and it has no problem receiving a response.

---

<div class="post-metadata">

**Author:** ![owossoborn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@owossoborn](https://www.ruby-forum.com/u/owossoborn)\
**Post date:** [July 8, 2009, 7:44am UTC](https://www.ruby-forum.com/t/app-fails-on-windows-but-works-on-os-x/171679/6 "2009-07-08T07:44:07Z")

</div>

Thank you so much, Roger! Setting Basic\_Socket.do\_not\_reverse\_lookup to  
true fixed the issue.

Can’t thank you enough, this problem was driving me absolutely mad!

Roger P. wrote:

> Randy G. wrote:
> 
> > I’ve been working on a query app for Battlefield 2142 servers, and the  
> > following app always fails on some IPs in Windows:
> > 
> > [http://pastie.org/537069.txt](http://pastie.org/537069.txt)
> 
> I assume flipping the order doesn’t help? I would probably next make  
> sure ping works between the machines, if it does then try wire sharking  
> to see what is happening. Maybe  
> BasicSocket.do\_not\_reverse\_lookup = true
> 
> [http://rubydoc.ruby-forum.com/doc/ruby-1.9.1-p129/classes/BasicSocket.html#M002524](http://rubydoc.ruby-forum.com/doc/ruby-1.9.1-p129/classes/BasicSocket.html#M002524)
> 
> =r

---

<div class="post-metadata">

**Author:** ![owossoborn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/f19dbf/32.png) [@owossoborn](https://www.ruby-forum.com/u/owossoborn)\
**Post date:** [July 7, 2009, 9:51pm UTC](https://www.ruby-forum.com/t/app-fails-on-windows-but-works-on-os-x/171679/7 "2009-07-07T21:51:06Z")

</div>

Randy G. wrote:

> I’ve been working on a query app for Battlefield 2142 servers, and the  
> following app always fails on some IPs in Windows:
> 
> [http://pastie.org/537069.txt](http://pastie.org/537069.txt)

I assume flipping the order doesn’t help? I would probably next make  
sure ping works between the machines, if it does then try wire sharking  
to see what is happening. Maybe  
BasicSocket.do\_not\_reverse\_lookup = true

[http://rubydoc.ruby-forum.com/doc/ruby-1.9.1-p129/classes/BasicSocket.html#M002524](http://rubydoc.ruby-forum.com/doc/ruby-1.9.1-p129/classes/BasicSocket.html#M002524)

=r
