Several questions about the Socket application from UNIX to Windows transplant

xiaoxiao2021-03-06  17

Several Socket applications from UNIX should pay attention to Windows transplantation Several questions from UNIX to Windows Transplantation, Shandong Zibo City Construction Bank Science and Technology Sun Chengshan Socket (Socket) Become the most popular network communication application interface. Sockets were initially divided by Berkeley, Calif, Berkeley, developed to UNIX operating systems, which was transplanted to DOS and Windows systems, especially in recent years, have been widely popular in the world, and has grown rapidly. It has further laid its dominance in the field of network communication program development. Cross-system network interconnection is getting higher and higher in my country. Recently, in the development of banks and securities networking systems, we tried to do transplants from UNIX Sockets to Windows Sockets communication applications, seeing to work with the problems that should be paid attention to in the transplantation process. The people will work together to discuss, in order to play the role of tile jade.

Modify the definition of the header file in the UNIX Sockets application contains the statement of the header file as #include , and the corresponding statement in the Windows Sockets application should be #include . The statement containing the header file in the UNIX Sockets application is #include , and the corresponding statement in the Windows Sockets application should be #include . The implementation of Windows Sockets consists of two parts, namely development components and runtime components. The development component is for programmers to develop Windows Sockets applications, which includes Windows Sockets application interface functions libraries, header files, and some documents that describe Windows Sockets implementation, where header file Winsock.h contains Windows Sockets implementation defined. Macro, constant value, data structure, and function call interface prototype. Winsock.h is the header file that must be included in writing a Windows Sockets application. The implementation consists of two parts, namely development components and running components. The development component is for programmers to develop Windows Sockets applications, which includes Windows Sockets application interface functions libraries, header files, and some documents that describe Windows Sockets implementation, where header file Winsock.h contains Windows Sockets implementation defined. Macro, constant value, data structure, and function call interface prototype. Winsock.h is the header file that must be included in writing a Windows Sockets application. Windows Sockets DLL Initialization and Resource Release In the interface function of Windows Sockets, WSAStartup () is provided with two functions for initializing the Windows Sockets DLL resources at the end of the program when the program starts, they are Two functions that must be used when writing a Windows Sockets application. In the interface function of Windows Sockets, WSAStartup () is provided for two functions to initialize the Windows Sockets DLL resource at the end of the program, which must be used when writing Windows Sockets applications. Two functions. Change the type of socket from INT to Socket In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, ie UNSigned INT. In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, that is, the Unsigned INT type. Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror ().

Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets.

Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process.

WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use WSA macro fd_xxx

Control

FD_set

structure

with

Setsockopt ()

Function processing

int

Change to

Socket

Initialization and resource release

In the UNIX Sockets application, the statement containing the header file is #include , and the corresponding statement in the Windows Sockets application should be #include .

UNIX Sockets

The statement containing the header file in the application is

#include

, And in

Windows Sockets

The corresponding statement in the application should be

#include

.

The implementation of Windows Sockets consists of two parts, namely development components and runtime components. The development component is for programmers to develop Windows Sockets applications, which includes Windows Sockets application interface functions libraries, header files, and some documents that describe Windows Sockets implementation, where header file Winsock.h contains Windows Sockets implementation defined. Macro, constant value, data structure, and function call interface prototype. Winsock.h is the header file that must be included in writing a Windows Sockets application.

The implementation consists of two parts, namely development components and running components. Development components are for programmers development

Windows Sockets

Application is used, it includes

Windows Sockets

Application interface function library, header file, and some introduction

Windows Sockets

Implemented documentation, where the header file

Winsock.h

Contain

Windows Sockets

Implement the defined macro, constant value, data structure, and function call interface prototype.

Winsock.h

Write

Windows Sockets

The application must contain the header file.

Windows Sockets DLL Initialization and Resource Release In the interface function of Windows Sockets, WSAStartup () is provided with two functions for initializing the Windows Sockets DLL resources at the end of the program when the program starts, they are Two functions that must be used when writing a Windows Sockets application. In the interface function of Windows Sockets, WSAStartup () is provided for two functions to initialize the Windows Sockets DLL resource at the end of the program, which must be used when writing Windows Sockets applications. Two functions. Change the type of socket from INT to Socket In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, ie UNSigned INT. In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, that is, the Unsigned INT type. Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function.

Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program.

The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the fd_set structure and

Setsockopt ()

Function processing

int

Change to

Socket

Initialization and resource release

In the interface function of Windows Sockets, WSAStartup () is provided for two functions to initialize the Windows Sockets DLL resource at the end of the program, which must be written when writing a Windows Sockets application. Two functions used.

Windows Sockets

In the interface function, it is provided.

WSAStartup ()

versus

WSacleanup ()

Two functions for initialization at the beginning of the program

Windows Sockets DLL

Release Windows Sockets DLL at the end of the program

Resources, they are writing

Windows Sockets

Two functions must be used when the application is used.

Change the type of socket from INT to Socket In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, ie UNSigned INT. In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, that is, the Unsigned INT type. Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function.

Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function.

Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment.

In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the fd_set structure and

Setsockopt ()

Function processing

int

Change to

Socket

In UNIX systems, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, ie the unsigned int.

Unix

In the system, the socket type is defined as

int

Type,

Windows

In the system, the socket type is defined as

Socket

That is

Unsigned int

type.

Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment.

In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use WSA macro

FD_XXX

Control

FD_set

structure

with

Setsockopt ()

Function processing

In the UNIX system, get, set the error code to use global variable errno, and in the Windows system, it should be changed to function WsageTlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment.

Unix

In the system, obtain, set an error code to use global variables

Errno

, And in

Windows

It should be changed to function in the system.

Wsagetlasterror ()

with

Wsasetlasterror ()

.

Windows Sockets

In order to be compatible with multi-threaded environment, two error handages are provided

Wsagetlasterror ()

versus

Wsasetlasterror ()

To get the most recent error number of the current thread, no longer use

Unix

Global variable in the system

Errno

with

H_ERRNO

.

Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system.

The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program.

For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process.

Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the fd_set structure and

Setsockopt ()

Function processing

Use a close () function in the UNIX system to turn off the socket, and in the Windows system, use the closSocket () function.

Unix

Used in the system

Close ()

The function is turned off, but

Windows

In the system

CloseSocket ()

function.

Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system.

The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program.

For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process.

Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the fd_set structure and

Setsockopt ()

Function processing

In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system.

Unix

In the system, use

IOCTL ()

Function and

FCNTL ()

The function implements the control of the socket, but

Windows

Use in the system

ioctlsocket ()

function.

The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program.

For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process.

Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the fd_set structure and

Setsockopt ()

Function processing

The support of these two functions in UNIX Sockets and Windows Sockets is different. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

UNIX Sockets

with

Windows Sockets

The support provided by these two functions is different. in

Windows Sockets

in

Getsockopt ()

versus

Setsockopt ()

Unsupported

Berkeley Sockets

The options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support the use of The option will return error code WSAENOPROTOPT, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_RCVLOWAT

Accepting a low tide flag SO_RCVTIMEO Accepting timeout SO_SNDLOWAT Send a low tide flag SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR Take the error status and clear the SO_TYPE socket type Use Unsupported options will return errors Code WSAENoPROTOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_RCVTIMEO

Accepting the timeout SO_SNDLOWAT Send a low tide flag SO_SNDTIMEO Send Timeout IP_Options Get the option TCP_MAXSEG in the IP header TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to the SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENOPROTOOPT, it Returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_SNDLOWAT

Send a low tide flag so_sndtimeo Send Timeout IP_OPTIONS NOPTEG TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is made by WsageTlasterror The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_SNDTIMEO

Send Timeout IP_OPTIONS NOPTET TCP_MAXSEG gets TCP_MAXSEG to get TCP maximum SO_ACCEPTCONN sockets are listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENOPROTOPT, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Ip_options

Obtain

IP

The option TCP_MAXSEG acquired the TCP maximum size SO_ACCEPTCONN socket is listening to the SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

TCP_MAXSEG

Obtain

TCP

The maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_ACCEPTCONN

The socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_ERROR

Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_TYPE

Socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

Wsaenoprotoopt

, Which consists of

Wsagetlasterror ()

The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment.

In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to control the FD_SET Structure for the FD_SET Structure, which is consistent with UNIX Sockets, but their internal implementation is different from Unix Sockets, but their internal implementation is different from UNIX Sockets. In the parameters of the function select (), UNIX Sockets implements a bit mask for a set collection, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration.

Windows Sockets

Some functions are in the interface

UNIX Sockets

Consisten to, but their internal implementation is different, for example, in functions

SELECT ()

In the parameter,

UNIX Sockets

Implementing a set of text is a bit mask, but

Windows Sockets

It is used in it.

Socket

Array. Although the collection of sockets is still

FD_set

Type expression, but

UNIX Sockets

Direct modification in the source file

FD_set

Structure code

Windows Sockets

It will not work properly in the environment. therefore

,

The source program should be used in the source program when transplantation

FD_set

Direct modification is changed to use

FD_XXX

Macro modified.

You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process.

WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocked call to a message-based asynchronous operation Windows Sockets program to use the WSA Macro to define a lot of WSA's header files in the Windows Sockets program, using these macros in the program, can greatly add the program readable Sex. E.g:

Windows Sockets

Many of the head files defined

WSA

The opening of the macro, using these macros in the program, can greatly increase the readability of the program. E.g:

Errno = wsagetlasterror ();

;

IF (errno = wsaewouldblock) {...

) {...

......

} These macros are incorrectly occurring in Windows Sockets, which may have occurred in the application implementation process, which is specifically made for the read and write of the program. It is a specification that is followed by the Windows Sockets application to write staff developers, so try to Use these macros to increase program readability.

Windows Sockets

In the process of application implementation, there may be an error in order to facilitate the read and write of the program, it is

Windows Sockets

The specification followed by the application staff developer, so these macros should be used to increase the readability of the program.

The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows is a non-preemptive multi-task environment. The switch between the tasks is driven by message. If an application cannot actively give it control, other applications cannot be executed, This is the difference between the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following blocking processing functions:

It is a non-preemptive multi-task environment, and the switching between the tasks is driven by message. If an application cannot actively give up its control, other applications cannot be executed, this is

Unix

The operating system has the essence difference. From

UNIX Sockets

Applications where the transplantation in the environment must be considered. In order to solve the problem, Windows Sockets specially increases the following blocking process: Windows Sockets

The following occlusion process functions are promoted:

WSAISBLOCKING () Detection Call WSACANCELBLOCKINGCALL () Cancel WSASetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment When installing your own blocking process routine, you should pay attention to the program instant pointer to the returned previously installed blocking process, and recover after the end of the process.

Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process.

WSAcancelBlockingCall ()

Cancel a ongoing blocking call wsasetBlocking () Set your own blockblockingHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, should be installed Note that the program installs that hold the returned previously installed blocking process routines are saved, and recover after the processing is completed.

Wsasetblocking ()

Setting your own blockblocking routine WSAUNHOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking process of returning. Cheng's program instance pointer and recovered after the end of the process.

WSAUNHOKBLOCKINGHOOK ()

Restoring the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instant pointer to the returned previously installed blocking process, and end in the process After recovery.

Try to change the blocking call to the message-based asynchronous operation

Socket This has become the most popular network communication application interface. Sockets were initially divided by Berkeley, Calif, Berkeley, developed to UNIX operating systems, which was transplanted to DOS and Windows systems, especially in recent years, have been widely popular in the world, and has grown rapidly. It has further laid its dominance in the field of network communication program development. Cross-system network interconnection is getting higher and higher in my country. Recently, in the development of banks and securities networking systems, we tried to do transplants from UNIX Sockets to Windows Sockets communication applications, seeing to work with the problems that should be paid attention to in the transplantation process. The people will work together to discuss, in order to play the role of tile jade.

Modify the definition of the header file in the UNIX Sockets application contains the statement of the header file as #include , and the corresponding statement in the Windows Sockets application should be #include . The statement containing the header file in the UNIX Sockets application is #include , and the corresponding statement in the Windows Sockets application should be #include . The implementation of Windows Sockets consists of two parts, namely development components and runtime components. The development component is for programmers to develop Windows Sockets applications, which includes Windows Sockets application interface functions libraries, header files, and some documents that describe Windows Sockets implementation, where header file Winsock.h contains Windows Sockets implementation defined. Macro, constant value, data structure, and function call interface prototype. Winsock.h is the header file that must be included in writing a Windows Sockets application. The implementation consists of two parts, namely development components and running components. The development component is for programmers to develop Windows Sockets applications, which includes Windows Sockets application interface functions libraries, header files, and some documents that describe Windows Sockets implementation, where header file Winsock.h contains Windows Sockets implementation defined. Macro, constant value, data structure, and function call interface prototype. Winsock.h is the header file that must be included in writing a Windows Sockets application. Windows Sockets DLL Initialization and Resource Release In the interface function of Windows Sockets, WSAStartup () is provided with two functions for initializing the Windows Sockets DLL resources at the end of the program when the program starts, they are Two functions that must be used when writing a Windows Sockets application. In the interface function of Windows Sockets, WSAStartup () is provided for two functions to initialize the Windows Sockets DLL resource at the end of the program, which must be used when writing Windows Sockets applications. Two functions. Change the type of socket from INT to Socket In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, ie UNSigned INT. In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, that is, the Unsigned INT type. Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror ().

Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets.

Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process.

WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use WSA macro

FD_XXX

Control

FD_set

structure

with

Setsockopt ()

Function processing

int

Change to

Socket

Initialization and resource release

In the UNIX Sockets application, the statement containing the header file is #include , and the corresponding statement in the Windows Sockets application should be #include .

UNIX Sockets

The statement containing the header file in the application is

#include

, And in

Windows Sockets

The corresponding statement in the application should be

#include

.

The implementation of Windows Sockets consists of two parts, namely development components and runtime components. The development component is for programmers to develop Windows Sockets applications, which includes Windows Sockets application interface functions libraries, header files, and some documents that describe Windows Sockets implementation, where header file Winsock.h contains Windows Sockets implementation defined. Macro, constant value, data structure, and function call interface prototype. Winsock.h is the header file that must be included in writing a Windows Sockets application.

The implementation consists of two parts, namely development components and running components. Development components are for programmers development

Windows Sockets

Application is used, it includes

Windows Sockets

Application interface function library, header file, and some introduction

Windows Sockets

Implemented documentation, where the header file

Winsock.h

Contain

Windows Sockets

Implement the defined macro, constant value, data structure, and function call interface prototype.

Winsock.h

Write

Windows Sockets

The application must contain the header file.

Windows Sockets DLL Initialization and Resource Release In the interface function of Windows Sockets, WSAStartup () is provided with two functions for initializing the Windows Sockets DLL resources at the end of the program when the program starts, they are Two functions that must be used when writing a Windows Sockets application. In the interface function of Windows Sockets, WSAStartup () is provided for two functions to initialize the Windows Sockets DLL resource at the end of the program, which must be used when writing Windows Sockets applications. Two functions. Change the type of socket from INT to Socket In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, ie UNSigned INT. In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, that is, the Unsigned INT type. Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function.

Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program.

The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the fd_set structure and

Setsockopt ()

Function processing

int

Change to

Socket

Initialization and resource release

In the interface function of Windows Sockets, WSAStartup () is provided for two functions to initialize the Windows Sockets DLL resource at the end of the program, which must be written when writing a Windows Sockets application. Two functions used.

Windows Sockets

In the interface function, it is provided.

WSAStartup ()

versus

WSacleanup ()

Two functions for initialization at the beginning of the program

Windows Sockets DLL

Release Windows Sockets DLL at the end of the program

Resources, they are writing

Windows Sockets

Two functions must be used when the application is used.

Change the type of socket from INT to Socket In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, ie UNSigned INT. In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, that is, the Unsigned INT type. Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function.

Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function.

Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment.

In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the fd_set structure and

Setsockopt ()

Function processing

int

Change to

Socket

In UNIX systems, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, ie the unsigned int.

Unix

In the system, the socket type is defined as

int

Type,

Windows

In the system, the socket type is defined as

Socket

That is

Unsigned int

type.

Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment.

In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use WSA macro

FD_XXX

Control

FD_set

structure

with

Setsockopt ()

Function processing

In the UNIX system, get, set the error code to use global variable errno, and in the Windows system, it should be changed to function WsageTlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment.

Unix

In the system, obtain, set an error code to use global variables

Errno

, And in

Windows

It should be changed to function in the system.

Wsagetlasterror ()

with

Wsasetlasterror ()

.

Windows Sockets

In order to be compatible with multi-threaded environment, two error handages are provided

Wsagetlasterror ()

versus

Wsasetlasterror ()

To get the most recent error number of the current thread, no longer use

Unix

Global variable in the system

Errno

with

H_ERRNO

.

Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system.

The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program.

For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process.

Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the fd_set structure and

Setsockopt ()

Function processing

Use a close () function in the UNIX system to turn off the socket, and in the Windows system, use the closSocket () function.

Unix

Used in the system

Close ()

The function is turned off, but

Windows

In the system

CloseSocket ()

function.

Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system.

The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program.

For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process.

Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the fd_set structure and

Setsockopt ()

Function processing

In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system.

Unix

In the system, use

IOCTL ()

Function and

FCNTL ()

The function implements the control of the socket, but

Windows

Use in the system

ioctlsocket ()

function.

The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program.

For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process.

Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the fd_set structure and

Setsockopt ()

Function processing

The support of these two functions in UNIX Sockets and Windows Sockets is different. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

UNIX Sockets

with

Windows Sockets

The support provided by these two functions is different. in

Windows Sockets

in

Getsockopt ()

versus

Setsockopt ()

Unsupported

Berkeley Sockets

The options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support the use of The option will return error code WSAENOPROTOPT, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_RCVLOWAT

Accepting a low tide flag SO_RCVTIMEO Accepting timeout SO_SNDLOWAT Send a low tide flag SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR Take the error status and clear the SO_TYPE socket type Use Unsupported options will return errors Code WSAENoPROTOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_RCVTIMEO

Accepting the timeout SO_SNDLOWAT Send a low tide flag SO_SNDTIMEO Send Timeout IP_Options Get the option TCP_MAXSEG in the IP header TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to the SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENOPROTOOPT, it Returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_SNDLOWAT

Send a low tide flag so_sndtimeo Send Timeout IP_OPTIONS NOPTEG TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is made by WsageTlasterror The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_SNDTIMEO

Send Timeout IP_OPTIONS NOPTET TCP_MAXSEG gets TCP_MAXSEG to get TCP maximum SO_ACCEPTCONN sockets are listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENOPROTOPT, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Ip_options

Obtain

IP

The option TCP_MAXSEG acquired the TCP maximum size SO_ACCEPTCONN socket is listening to the SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

TCP_MAXSEG

Obtain

TCP

The maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_ACCEPTCONN

The socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_ERROR

Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_TYPE

Socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

Wsaenoprotoopt

, Which consists of

Wsagetlasterror ()

The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment.

In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to control the FD_SET Structure for the FD_SET Structure, which is consistent with UNIX Sockets, but their internal implementation is different from Unix Sockets, but their internal implementation is different from UNIX Sockets. In the parameters of the function select (), UNIX Sockets implements a bit mask for a set collection, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration.

Windows Sockets

Some functions are in the interface

UNIX Sockets

Consisten to, but their internal implementation is different, for example, in functions

SELECT ()

In the parameter,

UNIX Sockets

Implementing a set of text is a bit mask, but

Windows Sockets

It is used in it.

Socket

Array. Although the collection of sockets is still

FD_set

Type expression, but

UNIX Sockets

Direct modification in the source file

FD_set

Structure code

Windows Sockets

It will not work properly in the environment. therefore

,

The source program should be used in the source program when transplantation

FD_set

Direct modification is changed to use

FD_XXX

Macro modified.

You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process.

WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocked call to a message-based asynchronous operation Windows Sockets program to use the WSA Macro to define a lot of WSA's header files in the Windows Sockets program, using these macros in the program, can greatly add the program readable Sex. E.g:

Windows Sockets

Many of the head files defined

WSA

The opening of the macro, using these macros in the program, can greatly increase the readability of the program. E.g:

Errno = wsagetlasterror ();

;

IF (errno = wsaewouldblock) {...

) {...

......

} These macros are incorrectly occurring in Windows Sockets, which may have occurred in the application implementation process, which is specifically made for the read and write of the program. It is a specification that is followed by the Windows Sockets application to write staff developers, so try to Use these macros to increase program readability.

Windows Sockets

In the process of application implementation, there may be an error in order to facilitate the read and write of the program, it is

Windows Sockets

The specification followed by the application staff developer, so these macros should be used to increase the readability of the program.

The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows is a non-preemptive multi-task environment. The switch between the tasks is driven by message. If an application cannot actively give it control, other applications cannot be executed, This is the difference between the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following blocking processing functions:

It is a non-preemptive multi-task environment, and the switching between the tasks is driven by message. If an application cannot actively give up its control, other applications cannot be executed, this is

Unix

The operating system has the essence difference. From

UNIX Sockets

Applications where the transplantation in the environment must be considered. In order to solve the problem, Windows Sockets specially increases the following blocking process: Windows Sockets

The following occlusion process functions are promoted:

WSAISBLOCKING () Detection Call WSACANCELBLOCKINGCALL () Cancel WSASetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment When installing your own blocking process routine, you should pay attention to the program instant pointer to the returned previously installed blocking process, and recover after the end of the process.

Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process.

WSAcancelBlockingCall ()

Cancel a ongoing blocking call wsasetBlocking () Set your own blockblockingHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, should be installed Note that the program installs that hold the returned previously installed blocking process routines are saved, and recover after the processing is completed.

Wsasetblocking ()

Setting your own blockblocking routine WSAUNHOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking process of returning. Cheng's program instance pointer and recovered after the end of the process.

WSAUNHOKBLOCKINGHOOK ()

Restoring the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instant pointer to the returned previously installed blocking process, and end in the process After recovery.

Try to change the blocking call to the message-based asynchronous operation

Modify the definition of the header file in the UNIX Sockets application contains the statement of the header file as #include , and the corresponding statement in the Windows Sockets application should be #include . The statement containing the header file in the UNIX Sockets application is #include , and the corresponding statement in the Windows Sockets application should be #include . The implementation of Windows Sockets consists of two parts, namely development components and runtime components. The development component is for programmers to develop Windows Sockets applications, which includes Windows Sockets application interface functions libraries, header files, and some documents that describe Windows Sockets implementation, where header file Winsock.h contains Windows Sockets implementation defined. Macro, constant value, data structure, and function call interface prototype. Winsock.h is the header file that must be included in writing a Windows Sockets application. The implementation consists of two parts, namely development components and running components. The development component is for programmers to develop Windows Sockets applications, which includes Windows Sockets application interface functions libraries, header files, and some documents that describe Windows Sockets implementation, where header file Winsock.h contains Windows Sockets implementation defined. Macro, constant value, data structure, and function call interface prototype. Winsock.h is the header file that must be included in writing a Windows Sockets application. Windows Sockets DLL Initialization and Resource Release In the interface function of Windows Sockets, WSAStartup () is provided with two functions for initializing the Windows Sockets DLL resources at the end of the program when the program starts, they are Two functions that must be used when writing a Windows Sockets application. In the interface function of Windows Sockets, WSAStartup () is provided for two functions to initialize the Windows Sockets DLL resource at the end of the program, which must be used when writing Windows Sockets applications. Two functions. Change the type of socket from INT to Socket In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, ie UNSigned INT. In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, that is, the Unsigned INT type. Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror ().

Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets.

Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process.

WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to control the process of the FD_SET structure and the setsockopt () function in the Windows Sockets program. INT is changed to the Socket initialization and resource release in the UNIX Sockets application. In order to #include , the corresponding statement in the Windows Sockets application should be #include . The statement containing the header file in the UNIX Sockets application is #include , and the corresponding statement in the Windows Sockets application should be #include . The implementation of Windows Sockets consists of two parts, namely development components and runtime components. The development component is for programmers to develop Windows Sockets applications, which includes Windows Sockets application interface functions libraries, header files, and some documents that describe Windows Sockets implementation, where header file Winsock.h contains Windows Sockets implementation defined. Macro, constant value, data structure, and function call interface prototype. Winsock.h is the header file that must be included in writing a Windows Sockets application. The implementation consists of two parts, namely development components and running components. The development component is for programmers to develop Windows Sockets applications, which includes Windows Sockets application interface functions libraries, header files, and some documents that describe Windows Sockets implementation, where header file Winsock.h contains Windows Sockets implementation defined. Macro, constant value, data structure, and function call interface prototype. Winsock.h is the header file that must be included in writing a Windows Sockets application. Windows Sockets DLL Initialization and Resource Release In the interface function of Windows Sockets, WSAStartup () is provided with two functions for initializing the Windows Sockets DLL resources at the end of the program when the program starts, they are Two functions that must be used when writing a Windows Sockets application. In the interface function of Windows Sockets, WSAStartup () is provided for two functions to initialize the Windows Sockets DLL resource at the end of the program, which must be used when writing Windows Sockets applications. Two functions.

Change the type of socket from INT to Socket In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, ie UNSigned INT. In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, that is, the Unsigned INT type. Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function.

Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function.

Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment.

In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to control the processing of the FD_SET structure and the setsockopt () function of the FD_set structure and the Socket initialization and resource release in the interface function of Windows Sockets, providing WSAStartup () Two functions of WSacleanup (), used to initialize the Windows Sockets DLL resource at the end of the program, which is the two functions that must be used when writing a Windows Sockets application. In the interface function of Windows Sockets, WSAStartup () is provided for two functions to initialize the Windows Sockets DLL resource at the end of the program, which must be used when writing Windows Sockets applications. Two functions. Change the type of socket from INT to Socket In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, ie UNSigned INT. In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, that is, the Unsigned INT type. Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError ().

Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets.

Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process.

Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to control the processing of the FD_SET structure and the setsockopt () function INT change to Socket, the socket type is defined as an int type. In a Windows system, the socket type is defined as a socket type, that is, the Unsigned INT type. In the UNIX system, the socket type is defined as an INT type, and in the Windows system, the socket type is defined as a socket type, that is, the Unsigned INT type. Errors Acquisition and Settings In the UNIX system, get, set the error code to use global variable errno, and change it in a Windows system to use Function WsageTlasterror () and WsasetLastError (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system.

The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program.

For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process.

Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to control the WSA macro fd_xxx to control the processing of the fd_set structure and the setsockopt () function in the UNIX system, get, set the error code to use global variable errno, while in the Windows system It should be changed to the function wsagetlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. In a UNIX system, it is obtained, and the error code is used to use global variable errno, and in the Windows system, it should be changed to function wsagetlasterror () and wsasetlasterror (). Windows Sockets provides two error handlers WsageTlasterror () with WSaseTlasterror () to get the nearest error number of setting the current thread without using the multi-threaded environment. Close socket uses a close () function in a UNIX system to close the socket, and in the Windows system, use the closSocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment.

In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the processing of the FD_SET structure and the setsockopt () function using a close () function in the UNIX system to turn off the socket, and in the Windows system In the middle, use the closockocket () function. The Close () function is used to close the socket in the UNIX system, while in the Windows system, use the ClosSocket () function. Control of sockets In UNIX systems, use the IOCTL () function and the FCNTL () function to implement control of the socket, and the ioctlsocket () function should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function.

Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration. IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program.

The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to use the WSA macro fd_xxx to control the processing of the FD_SET structure and the setsockopt () function in the UNIX system, using the ioctl () function and the FCNTL () function to implement the socket Word control, and IOCTLSocket () functions should be used in the Windows system. In the UNIX system, the IOCTL () function and the FCNTL () function implement the control of the socket, and the ioctlSocket () function should be used in the Windows system. The process of GetSockOpt () and setsockopt () functions is different from the support of these two functions in UNIX Sockets and Windows Sockets.

In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program.

For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process.

Try to change the blocked call to a message-based asynchronous operation Windows Sockets program to control the FD_SET structure and the setsockopt () function of the FD_SET structure and the setsockopt () function in Unix Sockets and Windows Sockets. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Unix Sockets and Windows Sockets are different from these two functions. In the Windows Sockets getsockopt () and setsockopt () does not support the Berkeley Sockets options are: SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is SO_ACCEPTCONN Monitor SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVLOWAT accept the low tide mark SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type does not support using the options will return Errors WSAENOPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_RCVTIMEO accept the low tide mark SO_SNDTIMEO timeout SO_SNDLOWAT send send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, It returns by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDLOWAT send low tide mark SO_SNDTIMEO send timeout IP_OPTIONS bring options TCP_MAXSEG IP header to obtain the maximum size of the TCP socket is listening SO_ERROR take SO_ACCEPTCONN error status and clear SO_TYPE socket type not supported by the option will return an error code WSAENOPROTOOPT, which consists of WSAGetLastError () The function returns. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_SNDTIMEO Send Timeout IP_OPTIONS NOPT TCP_MAXSEG gets TCP_maxseg to get the TCP maximum size SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use Unsupported options will return error code WSAENOPROTOOPT, which is returned by the wsagetlasterror () function . Since the support is provided, it is necessary to modify the corresponding source program when performing migration.

IP_OPTIONS NOT TCP_MAXSEG acquisition TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. TCP_MAXSEG gets the TCP maximum SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ACCEPTCONN socket is listening to SO_ERROR to take the error status and clear the SO_TYPE socket type Use the unsupported option to return to the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. SO_ERROR Take the error status and clear the SO_TYPE socket type Use the unsupported option to return the error code WSAENoProtoOpt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. The SO_TYPE socket type uses the unsupported option to return the error code WSAENoProtoPt, which is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. WSAENoPROTOOPT, it is returned by the wsagetlasterror () function. Since the support is provided, it is necessary to modify the corresponding source program when performing migration. Use macro fd_xxx to control the FD_SET structure Some functions of Windows Sockets are consistent with UNIX Sockets on the interface, but their internal implementation is different, for example, in the parameter of the function select (), UNIX Sockets implement socket collection The bit mask, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program.

For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process.

Try to change the blocking call to the message-based asynchronous operation Windows Sockets program to control the FD_SET Structure for the FD_SET Structure, which is consistent with UNIX Sockets, but their internal implementation is different from Unix Sockets, but their internal implementation is different from UNIX Sockets. In the parameters of the function select (), UNIX Sockets implements a bit mask for a set collection, but in Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. Windows Sockets Some functions are consistent with UNIX Sockets, but their internal implementation is not the same, for example, in the parameters of the function select (), UNIX Sockets implements a socket collection, but in The Windows Sockets is an array of Sockets. Although the collection of sockets is still represented by fd_set, the code directly modified the FD_SET structure in the UNIX Sockets source file will not work properly in the Windows Sockets environment. Therefore, the direct modification of the structure fd_set should be changed to the source program to be modified by using the fd_xxx macro when performing migration. You should try to use the WSA Macro in the Windows Sockets program to define a macro starting in the Windows Sockets header file, using these macros in the program, can greatly increase the readability of the program. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment.

In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocked call to a message-based asynchronous operation Windows Sockets program to use the WSA Macro to define a lot of WSA's header files in the Windows Sockets program, using these macros in the program, can greatly add the program readable Sex. For example: Windows Sockets defines a number of macros starting with WSA in the header file, using these macros in the program, can greatly increase the readability of the program. For example: errno = wsagetlasterror () ;; if (errno = wsaewouldblock) {...) {............} These macros are Windows Sockets may have errors in the application implementation process, dedicated to facilitating procedures Made of expansion, it is a specification that is followed by the Windows Sockets application to write a staff developer, so these macros should be used to increase the readability of the program. Windows Sockets may have an error in the application implementation process, to expand for the read and write of the program, which is a specification that is followed by the Windows Sockets application to write staff developers, so they should try to use these macros. To increase the readability of the program. The processing of blocking calls Windows is a non-preemptive multi-task environment. The switching between the tasks is driven by message. If an application cannot actively give it to control, other applications cannot be executed, this is to have a UNIX operating system The difference in essence. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment.

In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation Windows is a non-preemptive multi-task environment. The switch between the tasks is driven by message. If an application cannot actively give it control, other applications cannot be executed, This is the difference between the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment. In order to solve the problem, Windows Sockets specially increases the following block processing functions: It is a non-preemptive multi-task environment, and the switch between the tasks is driven by message. If an application cannot actively abandon its control, other applications It is not possible to implement, this point is the essence of the UNIX operating system. The blocking problem must be considered for applications that are transplanted from the UNIX Sockets environment.

In order to solve the problem, Windows Sockets specially increases the following block processing functions: Windows Sockets specials an increase in blocking processing function: wsaisblocking () detection blocking call WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking ) Setting your own blockblocking routine WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, when installing your own blocking process routine, pay attention to the previously installed blocking processing returned. The program instance pointer of the routine is recovered after the end of the process. Detection blocking calls WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetBlocking () Setting your own blocking process routine WSAUNHOOKBLOCKINGHOOK () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, installation When you block your own blocking process, you should pay attention to the program instant pointer to the returned previously installed blocking process routine and recovered after the end of the process. WSACANCELBLOCKINGCALL () Cancel a ongoing blocking call wsasetblocking () Sets your own blockblockingHOK () Restore the default blocking process routine does not affect the blocked process routine in the original environment, install your own blocking process routine At the time, you should pay attention to the program instance pointer to the returned previously installed blocking process routine and recover after the end of the process. WsaseTBlocking () Sets your own blockblocking routine WSAunhookBlockingHook () Restore the default blocking process routine is not affecting the blocked process routine in the original environment, pay attention to the previously installed predetermined installation of the returned. The program instance pointer of the blocking process routine and recovered after the end of the process. WSAUNHOKBLOCKINGHOK () Restore the default blocking process routine is not affecting the blocking process routine in the original environment, when installing your own blocking process routine, pay attention to the program instance pointer to the returned previously installed blocking process, and Recovered after the end of the process. Try to change the blocking call to the message-based asynchronous operation in the Windows Sockets network program design, although it allows blocking operations, a blocking may block the entire Windows environment, and in the UNIX Sockets program, the default mode of operation of the socket is Blocking. Windows Sockets adopts messy asynchronous access policies in order to support Windows messaging mechanisms. To this end, it is recommended to change the blocking call in the source program to the message-based asynchronous operation. Windows Sockets has added the following functions to achieve asynchronous access operations:

WSAAsyncSelect () standard Berkeley function select () asynchronous version of the standard Berkeley function select () asynchronous version WSAAsyncGetXByY () standard Berkeley function getXbyY () asynchronous version of the standard Berkeley function getXbyY () asynchronous version WSACancelAsyncRequest () to cancel the function WSAAsyncGetXByY () The implementation of the instance of the execution is a more cumbersome work to Windows Sockets, in addition to the direct related to Sockets, in addition to the specific implementation of Sockets, and should pay attention to the difference in development environment. There should be some corresponding adjustments on the program, for example, some pointers related to the Windows application should be set to the FAR type, etc., here no longer go further, the instance of the function wsaasyncgetxbyy () is executed by UNIX Sockets application Transplantation to Windows Sockets is a more cumbersome work, in addition to the direct related to Sockets, in addition to Sockets, it should also pay attention to the differences in the development environment. At this time, there should be some corresponding adjustments. For example, some of the pointers related to the Windows application should be set to the FAR type, etc., here will not be described in the Windows Sockets network program design, although it allows the blocking operation, but a blocking may block the entire Windows environment. In the UNIX Sockets program, the default operation mode of the socket is blocked. Windows Sockets adopts messy asynchronous access policies in order to support Windows messaging mechanisms. To this end, it is recommended to change the blocking call in the source program to the message-based asynchronous operation. Windows Sockets has added the following functions to achieve asynchronous access operations:

WSAAsyncSelect () standard Berkeley function select () asynchronous version of the standard Berkeley function select () asynchronous version WSAAsyncGetXByY () standard Berkeley function getXbyY () asynchronous version of the standard Berkeley function getXbyY () asynchronous version WSACancelAsyncRequest () to cancel the function WSAAsyncGetXByY () The implementation of the instance of the execution is a more cumbersome work to Windows Sockets, in addition to the direct related to Sockets, in addition to the specific implementation of Sockets, and should pay attention to the difference in development environment. There should be some corresponding adjustments on the program, for example, some pointers related to the Windows application should be set to the FAR type, etc., here no longer go further, the instance of the function wsaasyncgetxbyy () is executed by UNIX Sockets application Transplantation to Windows Sockets is a more cumbersome work, in addition to the direct related to Sockets, in addition to Sockets, it should also pay attention to the differences in the development environment. At this time, there should be some corresponding adjustments. For example, some pointers related to the Windows application should be set to a FAR type, etc., this is no longer a day.

Windows Sockets has added the following functions to achieve asynchronous access operations:

WSAAsyncSelect () standard Berkeley function select () asynchronous version of the standard Berkeley function select () asynchronous version WSAAsyncGetXByY () standard Berkeley function getXbyY () asynchronous version of the standard Berkeley function getXbyY () asynchronous version WSACancelAsyncRequest () to cancel the function WSAAsyncGetXByY () The implementation of the instance of the execution is a more cumbersome work to Windows Sockets, in addition to the direct related to Sockets, in addition to the specific implementation of Sockets, and should pay attention to the difference in development environment. There should be some corresponding adjustments on the program, for example, some pointers related to the Windows application should be set to the FAR type, etc., here no longer go further, the instance of the function wsaasyncgetxbyy () is executed by UNIX Sockets application Transplantation to Windows Sockets is a more cumbersome work, in addition to the direct related to Sockets, in addition to Sockets, it should also pay attention to the differences in the development environment. At this time, there should be some corresponding adjustments. For example, some pointers related to the Windows application should be set to the FAR type, etc., this is no longer a further version of the WSAASYNCSELECT () standard Berkeley function select () asynchronous version

standard

Berkeley

function

SELECT ()

Asynchronous version

WSaasyncGetxby () Standard Berkeley Function getXByy ()

standard

Berkeley

function

Getxbyy ()

Asynchronous version

WSACANCELASYNCREQUEST () Cancel Function WSAAsyncGETXBYY () Execution The implementation of the Unix Sockets application to Windows Sockets is a more cumbersome work, in addition to the direct related to Sockets, in addition to the specific implementation of Sockets, should pay attention to procedures The difference in the development environment should also be adjusted on the program, for example, some pointers related to the Windows application should be set to the FAR type, etc., here is no longer described here.

Cancel function

WSaasyncGetxbyy ()

The implementation of the instance of the execution is a more cumbersome work to Windows Sockets, in addition to the direct related to Sockets, in addition to the specific implementation of Sockets, and should pay attention to the difference in development environment. There should also be some corresponding adjustments, for example, some pointers related to the Windows application should be set to the FAR type, etc., here is no longer described.

Transplantation of the UNIX Sockets application is a more cumbersome work, in addition to the direct related to Sockets in the transplant, pay attention to the difference in the development environment, and the program should also be For some corresponding adjustments, for example, some pointers related to the Windows application should be set to the FAR type, etc., this is no longer

转载请注明原文地址:https://www.9cbs.com/read-44943.html

New Post(0)