Winsocks

16118 palavras 65 páginas
Chapter 7: Winsock Basics
This chapter is dedicated to learning the basic techniques and API calls necessary for writing successful network applications. In the last chapter, you learned how each protocol accessible from Winsock addresses machines and services on those machines. In this chapter, we’ll look at establishing a connection from one machine on the network to another, along with how to send and receive data. For simplicity’s sake, and to prevent repetition, the discussion in this chapter is limited to the TCP/IP protocol. However, this book’s companion CD contains client/server samples for each of the protocols covered in Chapter 6. The only protocol-dependent operation is socket creation. Most of the remaining Winsock calls that are required for establishing a connection and for sending and receiving data are independent of the underlying protocol. The exceptions were noted in Chapter 6 along with each protocol discussion.
The examples presented in this chapter help to provide an understanding of the Winsock calls that are required for accepting connections, establishing connections, and sending and receiving data. Because the purpose of this chapter is to learn these Winsock calls, the examples presented use straight blocking Winsock calls. Chapter 8 presents the different I/O models available in Winsock, including code examples.
Additionally, in this chapter we will present both the Winsock 1 and Winsock 2 versions of the various API functions. You can differentiate the two functions with the WSA prefix. If Winsock 2 updated or added a new API function in its specification, the function name is prefixed with WSA. For example, the Winsock 1 function to create a socket is simply socket. Winsock 2 introduces a newer version named WSASocket that is capable of using some of the new features made available in Winsock 2. There are a few exceptions to this naming rule. WSAStartup, WSACleanup, WSARecvEx, and WSAGetLastError are in the Winsock 1.1

Relacionados

  • Arte
    566 palavras | 3 páginas
  • Informatica
    305 palavras | 2 páginas
  • olga
    848 palavras | 4 páginas
  • Visual Basic
    983 palavras | 4 páginas
  • Fundamentos da arquitetura cliente-servidor
    11555 palavras | 47 páginas
  • ESTUDO SOBRE O ERRO 619
    3539 palavras | 15 páginas
  • conectividade social
    3226 palavras | 13 páginas
  • Servidores Proxy
    20457 palavras | 82 páginas
  • Parametrização
    284 palavras | 2 páginas
  • Cluster
    1527 palavras | 7 páginas