A socket is an
endpoint of communication—an object through which your application
communicates with other Windows Sockets
(Winsock) applications across a network. There are sockets
on the client and server sides.
The steps used on the client side for communication through
- Open. The networking application creates a socket for a
- Bind. The socket is assigned a name (address). In
TCP/IP, the application assigns a port, and may also assign an IP
address if the computer is multihomed.
- Connect. A connection is established with the server
socket, so that send and receive operations can take place. You can
connect a socket for which there has been no bind operation, and
the binding will take place as part of the connect operation. An
explicit bind operation is needed only if a specific port and IP
address are needed for the connection.
The steps used on the server side for communication through
- Open. Create the socket.
- Bind. The bind is usually performed on a well-known
- Listen. Be prepared to accept connections. The listen
operation takes place on the kernel level.
- Accept. Accept the connection and open a new socket for
it. This socket is passed to the application so that it can
communicate with the client. The listening socket continues to
listen for additional connect requests, so that other accept functions can take place.
For more information about sockets, see MSDN. For details about
using sockets with this product, see Socket Implementation in
about this topic to Microsoft
© 2008 Microsoft Corporation. All rights reserved.