I have spent most of the past few years as a contractor doing software development work. It came out of necessity (previous long-term employer went out of business) and hadn't been the original goal. That being said, I love it. I work from home, I make more money than I ever did as a W2 employee (even after taxes and paying myself benefits) and I can take advantage of an Individual 401(k) and put over $50,000 per year into my retirement savings tax free.
I found that it took 6-8 months of ceaseless hunting to get the pipeline "primed" and keep the contracts consistent. I have not and do not do government contracts-- private industry only. I made sure all of my friends and contracts knew that I was seeking contract work, what kind of work I did, and actively asked them (in person and on Facebook) if they knew of anyone looking for skills like mine. Most people will tell you that they don't know of anything right now, but will keep you in mind. It's up to you to keep the idea fresh in their minds by communicating well and doing some tactful marketing of yourself. Facebook worked well for me on this.
Once there were a constant stream of contracts coming in, they mostly sustained themselves by either being long term, or through word of mouth. Make sure to take good care of your customers.