MacDevCenter    
 Published on MacDevCenter (http://www.macdevcenter.com/)
 See this if you're having trouble printing code examples


Connecting Mac OS X to Windows PCs

by Wei-Meng Lee and Brian Jepson
11/19/2002

Mac users often have to share files with Windows machines, both at work and home. Occasionally, using portable media such as a ZIP disk or a USB portable storage does the job nicely, but for daily use a cross-platform network is more robust. Apple has incorporated technologies into Mac OS X that allow easy file sharing among platforms. And with the release of Mac OS X 10.2, networking became even easier.

In this article, we'll discuss how you can share files between your Mac and Windows machines and explore how Windows applications can be run on Mac OS X. All the examples in this article have been tested with version 10.2.1 of the operating system.

Systems Configuration

I have an eMac and a Pentium 4 PC (a HP notebook). I used an Ethernet cable to directly connect the two machines. The nice thing here is that I can use a straight cable to connect both machines, and my eMac is able to automatically detect that it is connecting to a PC. There is no need for a cross cable here.

Viewing PC files from a Mac

The first thing I want to try after connecting my two machines is to enable file sharing. On my PC, I created a folder and share it using the share name MacShare. On my Mac, I want to be able to access the shared folder. To connect to the shared folder, select Go from the Finder menu and click Connect to Server.

Screen shot.
Figure 1. Connecting to the server (PC) containing the shared folder.

You should be able to see the PC name displayed as shown in Figure 1. Select the PC and click Connect.

Screen shot.
Figure 2. Viewing the shared PC folder on the Mac

You will be prompted to enter the credentials to log on to the PC (domain/workgroup, username and password).

If the connection is successful, you will see the share icon as shown in Figure 2.

You can now browse the folder as though it is a local drive.

Viewing Mac Files from a PC

Because Mac OS 10.2 (Jaguar) contains a built in SMB/CIFS Server (Samba version 2.2.3a), viewing Mac files on the PC is straightforward. You can use your Network Neighborhood to view the shared folders on your Mac. To do that, you need to turn on the Windows File Sharing on your Mac (as shown in Figure 4), and check the Allow users to log in from Windows option (see Figure 3). If the account you are setting is yourself, you need to type your password into the Current Password field before you can change the checkbox.

SMB stands for Server Message Block. It's a lightweight protocol designed to allow the sharing of files and printers in a small network. SMB has since been renamed to CIFS, or Common Internet File System. Mac OS X 10.1 contains only the SMB client, and thus you can only use SMB to browse for files on the PC, and not vice versa. Mac OS X 10.2 contains both the SMB client and server, and hence PC users can browse for files on a Macintosh. For more information on SMB and Mac OS X, please see the Mac OS X and SMB HOWTO.

Screen shot.
Figure 3. Allowing Windows user to see the shared folder for a particular user account in Mac OS X.


Besides this method, two alternative ways to share Mac files with PC users would be to use Web Sharing and FTP.

To use Web sharing (using the built-in Apache Web server), check the Personal Web Sharing item under the Services category (see Figure 4) in your System Preferences window. Likewise to allow FTP access, check the FTP Access checkbox. By default, the folder exposed by the Web server is Sites (under the user's home directory).

Screen shot.
Figure 4. You can use Web Sharing and FTP to share files.

The FTP services, though, exposes the user's home directory. Hence, to share out any files on the Mac, you simply copy them to the respective folders, and they can then be accessed through FTP or the Web.

Screen shot.
Figure 5. The user's home directory.

To access the Mac files using FTP, you can use the command window in Windows and issue the following command:

C:\>ftp <IPAddressOfYourMac>

You can find out the IP address of your Mac in System Preferences --> Network --> TCP/IP

Screen shot.
Figure 6. Using FTP in the command window (Windows).

For Web sharing, you can use a Web browser, such as IE and enter the IP address of the Mac, followed by ~/username/.

Screen shot.
Figure 7. Accessing Mac folders using Web Sharing.

Controlling the PC Remotely from a Mac

Screen shot.
Figure 8. Using the Remote Desktop Connection to connect to Windows.

Sharing files between the Mac and the PC is good, but not enough for me. It would be better to be able to run my favorite PC applications on the Mac. While running a Windows application directly on the Mac is not technically possible, there are a couple of ways that come close to that. The first way is to pump out the display of a PC to the Mac. Microsoft provides the Remote Desktop Client (RDC) for that purpose. The second way (discussed in the next section) is to run a software emulator that emulates the Windows Operating System.

The RDC allows you to hook up your Mac to the network and remotely control your Windows system. To test drive RDC, I downloaded it and used it to connect to my Windows 2000 Advanced Server (W2KAS). To use RDC, you need to run Terminal Services on the Windows machine before the RDC can connect to it.

Screen shot.
Figure 9. Specifying the Windows server to connect to.

On the RDC connection window (see Figure 9), you can specify the login information, screen size, key mappings, etc. You can use the IP address, fully qualified machine name or netbiosname to connect to the Windows machine. As RDC is dependent on Terminal Services, you can connect to all Windows versions that supports Terminal Services, such as:

If it connects successfully, you should see the familiar Windows screen:

Screen shot.
Figure 10. Using RDC to connect to Windows 2000 Advanced Server.

The nice thing about RDC is that you can create multiple instances of Windows using a single Windows machine. Although RDC will only make one connection at a time, there is a trick you can use: duplicate the Remote Desktop Connection application, and use the original for one session and the copy for the other:

Screen shot.
Figure 11. Duplicating the RDC.

In Figure 12, I have two separate instances of Windows 2000 Advanced Server running. One is running Visual Studio .NET, and the other is running Adobe Acrobat:

Screen shot.
Figure 12. Running multiple instances of Windows using RDC.

Performance-wise, RDC is relatively fast. It translates keystrokes between the Mac and PC efficiently, and I have no problem in using my regular Control and Alternate (using the Option key on the Mac) keys when controlling my Windows PC. Running CPU-intensive applications like Visual Studio .NET has no effect on the performance on the Mac as all the processing is done on the Windows PC itself. I also have no problems running my regular applications like Word, PowerPoint, Adobe Acrobat, etc.

However, when two or more instances of Windows are created, the performance degrades drastically. But this is really the problem with the Windows server, as multiple clients connecting to the Terminal Services chalk up a lot of resources. Nevertheless, my notebook equipped with 512MB RAM and a 1GHz processor does not seem to digest the workload well.

Virtual PC

If you don't have a spare Windows PC to connect to, or if you are on the road with only your Macintosh notebook, another option is Virtual PC from Connectix. Virtual PC emulates the PC's CPU and hardware so that Windows, Linux, and other operating systems can run on it.

Virtual PC is available from Connectix in two flavors: with or without an operating system. (To be fair, this last flavor includes DOS). If you already have an unused license for the operating system you plan to use, you can buy Virtual PC with DOS for $129.00 from the Connectix store (http://www.connectix.com/shop/) and install your own operating system. If you choose electronic delivery, you can download it and install it right away (the disk image is about 12MB). After you download and install Virtual PC, you'll need to visit the Connectix support site to check for any updates. At the time of this writing, 5.0.4 was the most current.

If you purchased an operating system with Virtual PC, you'll be able to start working with it right away. If you purchased the version that only includes DOS, you'll need to install Windows. For instructions on installing another operating system, see the documentation in the /Applications/Virtual PC 5.0/Extras/Installing Other OSes/ directory.

Windows XP runs well on Virtual PC (seen in Figure 13), but you need to heavily optimize it to get the best performance. Plenty of memory is suggested (256MB is good for Windows XP Professional), and you should consult the "Optimizing Windows XP Professional and Home Edition For Connectix Virtual PC" document, which is available here. Aside from the tips in that document, we suggest aggressively diminishing the number of services you are running. TechSpot.com has a good article on this topic, as does ExtremeTech.

Screen shot.
Figure 13. Windows XP running under Virtual PC

Virtual PC and RDC Performance

So how well does Windows XP run under Virtual PC and RDC? To find out, we chose a CPU and disk-intensive test: building Microsoft's Shared Source CLI. We tested it on an 800 MHZ PC and a 600mhz dual USB iBook running various Mac OS X versions and Virtual PC.

CPU

MHZ

Real RAM

VM RAM

Mac OS

Duration

Pentium III

800

256

n/a

(RDC from 10.2.1)

0:15

Pentium III

800

256

n/a

n/a

0:15

G3

600

640

256

9.2.2

1:38

G3

600

640

256

10.1.5

2:02

G3

600

640

256

10.2.1 6D52

2:03

G3

600

640

128

10.2 6C115

3:09

G3

600

640

256

10.2 6C115

3:27

The CPU column lists the CPU of the machine running the test, and the MHZ column shows its speed. Real RAM is how much memory is installed inside the system, and VM RAM is how much was allocated to the virtual machine (in the case of the Pentium running Windows XP, this was not applicable). The duration is shown in hours:minutes.

The abysmal performance under the initial release of Jaguar (10.2, build 6C115) is due to bugs that were fixed in the 10.2.1 release. So, if you're going to use Virtual PC with Jaguar, make sure you run the Software Update in System Preferences to bring your system up to date.

Related Reading

Mac OS X for Unix Geeks
By Brian Jepson, Ernest E. Rothman

Our Verdict

From the times, you can see that running applications on a real PC is a huge win. 10.1.5 and 10.2.1 are very close, but running under 9.2.2 shaves about 25 minutes off the build. Still, the performance compared to a real PC is disappointing. And in everyday use, Virtual PC does not feel terribly snappy. For example, launching Visual Studio .NET takes 1 minute and 19 seconds before the start page appears using Virtual PC under Jaguar 10.2.1. Compare that to 28 seconds on the Pentium III machine. In fairness, once an application launches under Virtual PC, we've found that it performs adequately.

You can get by with Virtual PC, especially if you are willing to make some concessions For example, instead of using Visual Studio .NET, you could use Notepad or another lightweight editor for editing .NET programs, and compile them with the command-line compilers (cl, csc, vbc, and jsc). With these kinds of adjustments, life under Virtual PC is not so bad.

So, Virtual PC is the best bet for people who want to take their Macintosh on the road with them. But as 802.11b access points become more prevalent, and 3G networking takes off, it would not be unreasonable to use a Virtual Private Network connection in conjunction with the Remote Desktop Client to connect to a Windows server on a home or corporate network.

Wei-Meng Lee (Microsoft MVP) http://weimenglee.blogspot.com is a technologist and founder of Developer Learning Solutions http://www.developerlearningsolutions.com, a technology company specializing in hands-on training on the latest Microsoft technologies.

Brian Jepson is an O'Reilly editor, programmer, and co-author of Mac OS X Panther for Unix Geeks and Learning Unix for Mac OS X Panther. He's also a volunteer system administrator and all-around geek for AS220, a non-profit arts center in Providence, Rhode Island. AS220 gives Rhode Island artists uncensored and unjuried forums for their work. These forums include galleries, performance space, and publications. Brian sees to it that technology, especially free software, supports that mission. You can follow Brian's blog here.


Return to the Mac DevCenter.


Copyright © 2009 O'Reilly Media, Inc.