Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 1.24 KB

bind.md

File metadata and controls

59 lines (40 loc) · 1.24 KB

Home

Function name : bind

Group: Windows Sockets 2 (Winsock) - Library: ws2_32


The bind function associates a local address (IP address and port) with a socket.


Code examples:

How to build UDP responder
How to create non-blocking Winsock server

Declaration:

int bind(
  SOCKET s,
  const struct sockaddr* name,
  int namelen
);  

FoxPro declaration:

DECLARE INTEGER bind IN ws2_32 As ws_bind;
	INTEGER  s,;
	STRING @ sockaddr,;
	INTEGER  namelen
  

Parameters:

s [in] Descriptor identifying an unbound socket.

name [in] Address to assign to the socket from the sockaddr structure.

namelen [in] Length of the value in the name parameter, in bytes.


Return value:

If no error occurs, bind returns zero. Otherwise, it returns SOCKET_ERROR, and a specific error code can be retrieved by calling WSAGetLastError.


Comments:

In Visual FoxPro 8 declare bind function with an alias, because it may mix with BINDEVENT.