Skip to content

Latest commit

 

History

History
66 lines (48 loc) · 1.91 KB

File metadata and controls

66 lines (48 loc) · 1.91 KB

Home

Function name : socket

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


The socket function creates a socket that is bound to a specific service provider.


Code examples:

How to build UDP responder
Winsock: creating a socket that is bound to a specific service provider
Winsock: reading and setting socket options
Winsock: retrieving Web pages using sockets (HTTP, port 80)
Winsock: sending email messages (SMTP, port 25)
Winsock: retrieving directory listing from an FTP server using passive data connection (FTP, port 21)
Winsock: reading email messages (POP3, port 110)
Winsock: connecting to a news server (NNTP, port 119)
How to create non-blocking Winsock server
A client for testing non-blocking Winsock server

Declaration:

SOCKET socket(
  int af,
  int type,
  int protocol
);  

FoxPro declaration:

DECLARE INTEGER socket IN ws2_32;
	INTEGER af,;
	INTEGER type,;
	INTEGER protocol  

Parameters:

af [in] Address family specification.

type [in] Type specification for the new socket.

protocol [in] Protocol to be used with the socket that is specific to the indicated address family.


Return value:

If no error occurs, socket returns a descriptor referencing the new socket. Otherwise, a value of INVALID_SOCKET is returned.


Comments:

When a session has been completed, a closesocket must be performed.