Winsock API function Encyclopedia 2

Source: Internet
Author: User
Tags set socket socket string format

The Windows Sockets API interface provided by this system (winking) is a function (routine) as defined in version 1.1 of WINSOCK (as appendix) published on January 20, 1993; includes 30 Berkeley Software Dis Tribution (BSD) function and 16 functions that conform to the Windows message-driven feature.

(one) Inet_ntoa (): Converts a network address into a "point format" string.

Format: Char FAR * PASCAL FAR inet_ntoa (struct in_addr in);

Parameter: In a structure that represents an Internet address

Return value: Success-a "dot format" (dotted) string representing the address

Failed-NULL

Description: This function converts an Internet address into a "a.b.c.d" string format.

() ioctlsocket (): Controls the mode of the Socket.

Format: int PASCAL FAR ioctlsocket (SOCKET s, long cmd, u_long FAR *ARGP);

Parameters: s Socket identification code, CMD instruction name, argp pointing to cmd parameters of the index

Return value: Success-0

Failed-Socket_error (call WSAGetLastError () for reasons)

Description: This function is used to get or set the operating parameters of the Socket. The instructions provided are as follows:

Fionbio--Switch non-blocking mode

Fionread--The amount of data that can be read from the Socket

Siocatmark--OOB data has been read out (* Temporarily do not provide this feature)

() Listen (): Set Socket for listening status, ready to be connected.

Format: int PASCAL FAR Listen (SOCKET s, int backlog);

Parameter: The identifier of the S Socket, backlog the maximum number of connections required before the connection is completed (before the Accept () has been called)

Return value: Success-0

Failed-Socket_error (call WSAGetLastError () for reasons)

Description: The user can use this function to set the Socket into the listening state, and set up how many can be in the not really complete the connection before the end of the connection requirements. (The current maximum limit is 5, the minimum value is 1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.