Winsock Is a Standard Application Programming Interface (API)
www.installsetupconfig.com An Intro to Windows Socket (Winsock2) Programming & C Language What do we have in this session? Winsock Headers and Libraries Initializing Winsock Error Checking and Handling Addressing a Protocol Addressing IPv4 Internet Addresses Some Note inet_ntoa() Function InetNtop() Function InetPton() Function Byte Ordering Creating a Socket Connection-Oriented Communication Server API Functions Binding, bind() Listening, listen() Accepting Connections, accept() Client API Functions TCP States connect() Data Transmission send() and WSASend() WSASendDisconnect() Out-of-Band Data recv() and WSARecv() WSARecvDisconnect() Stream Protocols Scatter-Gather I/O Breaking the Connection shutdown() closesocket() TCP Receiver/Server With select() Example TCP Sender/client Program Example Testing the TCP Client and Server Programs Testing the TCP Client and Server Programs in Private Network Connectionless Communication Receiver Sender Running Both the UDP Receiver/Server and UDP Sender/Client Testing the UDP Client and select Server Programs in Private Network Message-Based Protocols Releasing Socket Resources 1 www.installsetupconfig.com Miscellaneous APIs getpeername() getsockname() WSADuplicateSocket() Windows CE Conclusion The following figure shows the TCP/IP stack for computer communication. Starting with the Open System Interconnection (OSI) seven layers and the TCP/IP stack. The Winsock is a library used for network communication programming for Windows. 7 Application e.g. HTTP, SMTP, SNMP, FTP, Telnet, SSH and Scp, NFS, RTSP etc. 6 Presentation e.g. XDR, ASN.1, SMB, AFP etc. 5 Session e.g. TLS, SSH, ISO 8327 / CCITT X.225, RPC, NetBIOS, ASP etc. 4 Transport e.g. TCP, UDP, RTP, SCTP, SPX, ATP etc. e.g. IP/IPv6, ICMP, IGMP, X.25, CLNP, ARP, RARP, BGP, OSPF, RIP, IPX, 3 Network DDP etc.
[Show full text]