Step 2 is also easy but requires jumping through some hoops to resolve the IP address. Step 3 is also easy, however there are a few points to remember. In otherwords, the program will hang at that point until data gets sent to you. This is in general a bad idea. Fortunately, there is a way around this.
Socket is ready to write to.
There is an exceptional condition. This occurs when out of band data is pending. This is out of scope for this article. It is possible to check multiple sockets at the same time, but that is left as an excercise for the reader. Writing to a socket is very easy.