AddListener
Last updated
Last updated
Adds a listening socket that will accept connections
Good to know: If you are creating a server that will accept connections from client (such as a web server) then you can use this method to start your application listening.
Call this method to start listening for a connection request on a particular port.
PortToListenOn
Port to listen on
Protocol
One of the constants (must be SQ_TCPIP---SQ_UDP is currently unsupported and is included for future extensibility only)
When a client attempts to connect to an application that has called the AddListener method, the listening application's ConnectionRequest event will fire, allowing the application to accept or reject the connection. Note that the return value of this method is the SocketHandle for the listening socket, and this handle must be used to close the socket (via the CloseSock method). If the call fails with a return value of INVALID_SOCKET (-1), use the LastSockErr property to get the error number (these are standard Winsock errors). Note that when this socket is closed, a ConnectionTerminated event will fire.
LONG CSockQ::AddListener(long PortToListenOn, INT Protocol, long AdapterNumber, long Backlog)