home *** CD-ROM | disk | FTP | other *** search
- <%
- ' **************************************************
- ' Example1: Connect to a POP3 mailserver, and list all incoming mails
- ' The file must be named 'example1.asp'
- ' **************************************************
- %>
-
- <!--#include file="ASocket.inc"-->
-
- <object runat=server progid="ActivXperts.Socket" id=asObj> </object>
-
- <%
- Function WaitForData( o )
- nRetr = 0
- Do While nRetr < 5 and o.HasData = False
- o.Sleep 2000
- nRetr = nRetr + 1
- Loop
- End Function
- %>
-
- <%
- If Request( "BUTTON_GO" ) <> "" Then
- asObj.Protocol = asPROTOCOL_TELNET
- asObj.Connect Request( "STR_MAILSERVER" ), 110
- Response.Write "Connect: result = " & asObj.LastError & "<br>"
-
- If asObj.LastError = asERR_WSAHOST_NOT_FOUND Then
- Response.Write "Error asERR_WSAHOST_NOT_FOUND: Specify a valid hostname-parameter in the Connect-method." & "<br>"
- End If
- If asObj.LastError = asERR_SUCCESS Then
-
- ' YES, we established a connection
-
- WaitForData( asObj )
- strReceived = asObj.ReceiveData
-
-
- asObj.Sleep 1000
- str = "user " & Request( "STR_COMMAND1" )
- asObj.SendString str
-
- WaitForData( asObj )
- str = asObj.ReceiveData
- strReceived = strReceived & str
-
- ' And finally, disconnect
- asObj.Disconnect
- End If
-
- End If
- %>
-
- <html>
- <body>
-
- <hr>
- <h1>ActivSocket <% = asObj.Version %> demo.</h1>
- Expiration date: <% = asObj.ExpirationDate %><br>
- <hr>
- <br>
- <form action="Example2.asp" method=post>
- <table>
- <td width="20"></td><td>Received:</td><td><textarea rows="13" name="TEXT_RECEIVED" cols="44" value = <% = strReceived %>></textarea></td><tr>
- <td width="20"></td><td>Host:</td><td><input size=40 type=text name="STR_HOST" value="140.109.4.14"></td><tr>
- <td width="20"></td><td>Command1:</td><td><input size=40 type=text name="STR_COMMAND1" value="library"></td><tr>
- <td></td><td><input type=Submit name="Go" value="Go">:</td><td> </td><tr>
- </table>
- </form>
-
- </body>
- </html>
-
- <% End If %>