How To: Migrate a VirtualBox Windows 7 client to VMware Player

Step 0 – [Linux-specific instruction] When installing VMware Player, let it use /etc/init.d/ even if your system uses Systemd. After install you can create a service for vmware like this:

/etc/systemd/system/vmware.service

Start the service with systemctl start vmware to make sure it kicks off. If you want it to start automatically at boot use systemctl enable vmware.

Step 1 – Disable any devices in the virtual machine that run on VirtualBox/Oracle drivers.

Step 2 – Convert the VirtualBox.vdi hard drive to VMDK format via “vboxmanage clonehd source.vdi target.vmdk –format VMDK”

Step 3 – Launch vmplayer and create a new virtual machine. Say that you’ll add the operating system later and let it use a ‘single large drive’ or such.

Step 4 – Replace the default created .vmdk drive with the one you converted in step 2.

Step 5 – You can try booting your VM at this point – if it works, GREAT! But it’s likely to bluescreen with a 0x000007b error, if so you’ll need to follow the rest of the steps below:

With all that done, the Windows 7 client should boot in vmware player and start installing the VMware specific drivers.

Twiddles / Housekeeping

VM audio crackling? Live with it – it crackles for a few seconds then sorts itself out. Fixing it as per the below causes VM crashes with “vcpu-0 unexpected signal 11” errors.
In Windows client go: Control Panel | Hardware and Audio | Sound | Speakers | Properties | set it to 24-bit @ 44.1KHz or higher.
Source: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2012007

VM suspends and stops Linux host from suspending? Shut down the VM, then edit the .VMX file it and add the line suspend.disabled = “TRUE” then restart.

VM generating “spurius APIC interrupt on #CPU X, should never happen”? Edit /etc/vmware/config and add the line monitor_control.disable_hostedIPI = TRUE then restart VM.

VMware tools won’t install? Either try to find the ISO to mount and install from or install ncurses5-compat-libs – on Arch this is in the AUR at: https://aur.archlinux.org/packages/ncurses5-compat-libs/

A simple C++/SDL_net chat server & client rewritten

Back in January this year I was due to be teaching some diploma level programming (roughly equivalent to the UK A/S level for any Brits), and part of that had to deal with network programming with sockets and stuff, so I duly did my research and put together a simple chat server and client in SDL_net. And then my classes changed and I got moved on to teach other stuff. I wasn’t too upset though – I’d learnt a lot, and I’d put up the code to help people out who might be in a similar situation, so it was all good.

But now in November I’m back on programming duty, so I dug up my code, looked it over, and thought Naah – I can’t use that, it’s unweildy, and complex, and it would be a real pain to try to re-use the code. So I’ve gone back to the drawing board and refactored it all into something I hope is a lot more palletable and both easy to use and re-purpose. In effect, I’ve refactored it into two wrappers which now consist of a ServerSocket class and a ClientSocket class.

Check it out…

Cross Platform Socket Server and Clients
Cross platform socket connectivity? That'll be a yes, then...

Socket Server

The old chat server was 250 lines, it’s now down to 77:

Socket Client

And the old chat client was 313 lines, which is now down to 83:

On top of all this we have try/catch exception handling, a nice encapsulated & easy to work-with/modify/extend design and debug flags to control whether the client/server should be verbose or run silently. Obviously the chat client itself can’t run completely silently – you wouldn’t be able to read the messages being sent back and forth! – but when debug is off it only ever outputs anything when it receives a message or when the user enters messages to send, so it’s pretty darn quiet.

Oh, and it now comes in Linux and Windows flavours =D

Overall I’m really happy with it – it’s taken a few days to properly redesign and test (not to mention the issues involved with porting to Windows) – but I think the next time I need to do some socket stuff with C++ I’d be able to grab this code, make whatever modifications I need and get something up and running in no time.

Awthome! =P

Download links

Notes on Building for Windows

The windows client and server projects have some important tweaks made for them to compile, and it’s worth mentioning what they are:

  • The solution (which contains two projects) comes comes with a copy of the SDL and SDL_net libs and headers all merged together in the SDL folder (well, there are separate libs and include folders, but all the headers from both are in the include folder and all the libs from both are in the libs folder).
  • Each project has the following libraries linked in: SDL.lib, SDLmain.lib and SDL_net.lib, these libraries point to…
  • SDL.dll and SDL_net.dll which are in the solution’s Debug folder, so you can compile and build from Visual Studio, BUT you’lll need to copy these two dll files into the same folder as the SocketServer-Rewritten.exe or SocketClient-Rewritten.exe folders to run the executables “standalone” in other locations as opposed to build-and-run-from-visual-studio style!
  • The projects are defined as console applications, and because SDLmain.lib defines the main function as int main(int argc, char *argv[]) and not just int main() you MUST keep the definition of main in-line with the SDLmain.lib definition.
  • Finally, the projects will only build successfully in debug mode. Why? I’ve no idea. If you know how to fix it then go for it!