:: WINSOCK CLASSIC ASP UNIX :: Send Comman and get Response

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sharmajv
    New Member
    • Apr 2013
    • 11

    :: WINSOCK CLASSIC ASP UNIX :: Send Comman and get Response

    Dear Sir

    Can someone post how to send a command to Unix Terminal using Winsock and Classic ASP..

    Much obliged

    Regards
    JAY
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    We don't give out codes here. We merely try to help if you are stuck with your code. If you want to get free code just use google. You'll find lots of results like this one http://www.ostrosoft.com/oswinsck/oswinsck_asp.asp

    Comment

    • sharmajv
      New Member
      • Apr 2013
      • 11

      #3
      Sir,

      Thanks for the Quick Reply..

      I am using the below Code

      Code:
      <%
      dim cmdtosend,sockval,strInData,strTemp,counter ,IP_ADD,PORT_NO,WAIT_TIME
      Response.Expires = -1000
      cmdtosend = "touch x.txt"
      
      IP_ADD = "172.25.23.12"
      
      PORT_NO = 22
      
      WAIT_TIME = 5
      
      
      if cmdtosend <> "" then
      set sockval = Server.CreateObject("MSWinsock1.Winsock")
      if not sockval.ConnectSock (IP_ADD,Clng(PORT_NO)) then
      Response.Write "Failed to connect"
      else
      Response.Write "Value is : " & cmdtosend & "<BR>"
      sockval.ConSendData cmdtosend & vbCr
      do while InStr(1,strInData,WAIT_TIME,vbTextCompare) = 0 and counter < 500000
      counter = counter + 1
      sockval.ConGetData strTemp
      strInData = strInData & strTemp
      sockval.ConDoEvents
      loop
      sockval.CloseSock
      end if
      set sockval = nothing
      end if
      if IsObject(sockval) then
      set sockval = nothing
      end if
      %>
      I am getting the below error

      Server object error 'ASP 0177 : 800401f3'

      Server.CreateOb ject Failed

      /ANJ/UNIX/1.asp, line 16

      800401f3
      Last edited by Rabbit; Apr 5 '13, 04:24 PM. Reason: Please use code tags when posting code.

      Comment

      • sharmajv
        New Member
        • Apr 2013
        • 11

        #4
        Any Help Is Really Appreciated

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          Did you install the Winsock Component properly and register it on your server?

          Comment

          • sharmajv
            New Member
            • Apr 2013
            • 11

            #6
            Yes Sir I Have registered WinSock

            Comment

            Working...