It's a good idea to knit big swatches and measure your gauge over 4" when you swatch for sweaters and other large garments. Since socks are small and meant to stretch over the foot, we can knit a little swatch and measure over a smaller area and still get accurate results.
Start with needles of the size recommended by the manufacturer and the type that you prefer for knitting in the round (dpns or circulars). Then cast on 40-60 stitches using the same method that you'll use for your socks and knit for 2" to 3" in stockinette stitch. You should now have a small knitted tube. This is your swatch. It should look something like this:
Sock gauge is a little tighter than normal because loose knitting wears out faster. Take a moment to examine your stitches. You should have a firm but stretchy fabric. There should be no gaps between stitches when the swatch is relaxed.
Gently poke your index finger through your swatch from back to front. (Imagine that your finger is your big toe and the sock is on your foot - that's the type of pressure you should apply.) Your finger should not separate the stitches by more than the width of one strand of yarn.
If there are gaps between your stitches or if your swatch fails the "toe test", purl one round and knit another 2" to 3" with smaller needles. If your stitches are so dense and tight that your swatch barely moves when you poke it, purl one round then knit another 2" to 3" with larger needles. Continue in this manner until you are satisfied with the fabric in your swatch.
Also check that your cast on edge is elastic and springy. If not, you may wish to cast on for your socks with larger needles. A tight cast on edge makes it difficult to put the sock on, so it's worthwhile to experiment a bit to get the cast on right.
You can of course just skip all the swatching and get right to knitting. I'll admit that I do very little swatching. I just wing it, and if the end result doesn't meet my expectations then I frog and start over. After you've done a few pairs of socks, you'll have a general idea of what size needles work best for you with different brands of yarns; at this point swatching becomes less of a necessity and more of a nicety.
NOTE: When dealing with small diameter needles, such as those used in socknitting, ignore the US sizing and go by millimeters. US sizes are not standardized, and a difference of just .25mm can make a very big difference in your gauge.
Your knitted gauge is two numbers: how many stitches are in one inch of knitting, and how many rows are in one inch of knitting. Stitches per inch is important when figuring how many stitches to cast on for a sock, while rows per inch helps you figure how many rounds to knit to make a sock of the desired length.
Lay your swatch out on a flat surface. Using a measuring tape or ruler, count how many stitches and rows there are in 1" of knitting. Try not to tug or squish your swatch as you do this; otherwise your gauge will be incorrect. Count half and quarter stitches, if necessary.
Be sure to take several measurements from different places on your swatch. If you notice that your gauge changes depending on where you measure, practice circular knitting until you can keep an even tension all around, then do another swatch.
