(Classic ASP) Example: Socket.AcceptNext method
Demonstrates how to call the AcceptNext method. Note: This example requires Chilkat v11.0.0 or greater.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set listenSocket = Server.CreateObject("Chilkat.Socket")
set connectedSocket = Server.CreateObject("Chilkat.Socket")
port = 5555
backlog = 25
success = listenSocket.BindAndListen(port,backlog)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( listenSocket.LastErrorText) & "</pre>"
Response.End
End If
' Accept next incoming connection
maxWaitMs = 200000
success = listenSocket.AcceptNext(maxWaitMs,connectedSocket)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( listenSocket.LastErrorText) & "</pre>"
Response.End
End If
' ...
' ...
maxWaitMs = 20000
success = connectedSocket.Close()
%>
</body>
</html>
|