<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: networking code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 17 May 2008 23:42:11 GMT</pubDate>
    <description>DZone Snippets: networking code</description>
    <item>
      <title>Python CGI script to display client's IP address</title>
      <link>http://snippets.dzone.com/posts/show/1840</link>
      <description>When run as a cgi script, this will print the client's IP address.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import cgi&lt;br /&gt;import os&lt;br /&gt;&lt;br /&gt;print "Content-type: text/html"&lt;br /&gt;print ""&lt;br /&gt;&lt;br /&gt;print cgi.escape(os.environ["REMOTE_ADDR"])&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 04 Apr 2006 19:54:21 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1840</guid>
      <author>madphilosopher (Darren Paul Griffith)</author>
    </item>
    <item>
      <title>Create VIPs on Mac OSX</title>
      <link>http://snippets.dzone.com/posts/show/763</link>
      <description>Virtual IPs are so damn useful it hurts sometimes. On Mac OS X 10.1 and above, they're extremely easy to create:&lt;br /&gt;&lt;br /&gt;Create a VIP on the same subnet as the primary interface(netmask must be 0xFFFFFFFF):&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# ifconfig en1 inet 192.168.1.130 netmask 255.255.255.255 alias&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Create a VIP on a different subnet:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# ifconfig en1 inet 192.168.64.25 netmask 255.255.255.0 alias&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;(Note: you may have to sub en0 for en1. Use ifconfig -a to find out what interfaces are available)&lt;br /&gt;&lt;br /&gt;Now you have another IP that you can bring stuff up on that won't collide with other stuff running on the same port. &lt;br /&gt;&lt;br /&gt;This is in no way limited to Rails but we can use it to illustrate. Create a VIP for 192.168.1.150 using the ifconfig command above. Then add a line to your /etc/hosts file as follows:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;192.168.1.150  myapp&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now bring Rails up bound to that address on port 80:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ cd devel/myapp&lt;br /&gt;$ ./script/server -b myapp -p 80&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;http://myapp/ should now be on Rails.&lt;br /&gt;</description>
      <pubDate>Sun, 25 Sep 2005 13:41:11 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/763</guid>
      <author>rtomayko (Ryan Tomayko)</author>
    </item>
  </channel>
</rss>
