O'Reilly logo

Network Programming for Microsoft® Windows®, Second Edition by Jim Ohlund, Anthony Jones

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending and Receiving Data

Sending and receiving data in .NET sockets is really simple. Once you have created a Socket object, you can use the Send, SendTo, Receive, and ReceiveFrom methods, which are similar to the send, sendto, recv, and recvfrom Winsock 1 APIs. There are several overloaded versions of these send and receive methods. Each one sends and receives data using a simple byte type array.

I/O Methods

.NET Sockets has three basic I/O methods to manage data and connections on a socket: blocking, select, and asynchronous. These resemble some of the I/O methods described in Chapter 5.

Blocking I/O

Blocking I/O is the simplest model to use. Anytime you call an I/O-bound .NET Sockets method, such as Receive, when there is no data pending ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required