ASP Source Code: iaspsock.asp

   ASP Script
   Comments
   HTML and Text

<HTML>
<HEAD>
<TITLE>iASPSock Test</TITLE>
</HEAD>
<BODY>
<H2 align=center>iASPSock Test</H2>
<P><BR>

<%
  rem On Error Resume Next
 

  rem ***********************************************************
  rem * Create the object
  rem ***********************************************************

  Set Socket = Server.CreateObject("ASPSock.Conn")

  rem ***********************************************************
  rem * Set the host we'll be connecting to
  rem ***********************************************************


  Socket.setRemoteHost "192.168.200.5"

  rem ***********************************************************
  rem * This is the NNTP (news) Port
  rem ***********************************************************

  Socket.setPort 7
 
  rem ***********************************************************
  rem * Open socket
  rem ***********************************************************

  If Socket.Open() then
     Response.Write "Connected" & "<br>"

     rem ***********************************************************
     rem * Time Setting
     rem ***********************************************************

     Socket.setTimeout(60)

     rem ***********************************************************
     rem * Message to Client
     rem ***********************************************************


     Socket.WriteLn "This is first line"
     Socket.Write "Write Method is Working <br>"
     Response.Write "Message has been Sent Successfully" & "<br>"

     rem ***********************************************************
     rem * Message from Client
     rem ***********************************************************

     Socket.WriteLn "WriteLine Method is Working"
     Response.Write "Message has been Sent Successfully" & "<br>"

     Response.Write "Reading first line..."  & "<br>"
     Response.Write Socket.ReadLn & "<br>"

     Response.Write "ReadBytesAsString begins..." & "<br>"
     Response.Write Socket.ReadBytesAsString(40)  & "<br>"

     Response.Write "We Are in ReadBytes: "  & "<br>"
     abc = socket.ReadBytes(5)
     for i = 0 to 4
        response.write(abc(i))
     next
     Response.Write "<br>"
     Response.Write "We Are in ReadLn"  & "<br>"
     Response.Write Socket.ReadLn

     rem ***********************************************************
     rem * Close the Socket
     rem ***********************************************************

     Socket.Close
  else
     Response.Write "<p>Connection Failed: " & Socket.error
  end if

  rem ***********************************************************
  rem * Release the object
  rem ***********************************************************

  Set Socket = nothing
%>

</BODY>
</HTML>


Copyright © 1998-2002, Halcyon Software Inc. All rights reserved.