By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,868 Members | 1,974 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,868 IT Pros & Developers. It's quick & easy.

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

P: 11
Dear Sir

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

Much obliged

Regards
JAY
Apr 5 '13 #1
Share this Question
Share on Google+
5 Replies


10K+
P: 13,264
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
Apr 5 '13 #2

P: 11
Sir,

Thanks for the Quick Reply..

I am using the below Code

Expand|Select|Wrap|Line Numbers
  1. <%
  2. dim cmdtosend,sockval,strInData,strTemp,counter ,IP_ADD,PORT_NO,WAIT_TIME
  3. Response.Expires = -1000
  4. cmdtosend = "touch x.txt"
  5.  
  6. IP_ADD = "172.25.23.12"
  7.  
  8. PORT_NO = 22
  9.  
  10. WAIT_TIME = 5
  11.  
  12.  
  13. if cmdtosend <> "" then
  14. set sockval = Server.CreateObject("MSWinsock1.Winsock")
  15. if not sockval.ConnectSock (IP_ADD,Clng(PORT_NO)) then
  16. Response.Write "Failed to connect"
  17. else
  18. Response.Write "Value is : " & cmdtosend & "<BR>"
  19. sockval.ConSendData cmdtosend & vbCr
  20. do while InStr(1,strInData,WAIT_TIME,vbTextCompare) = 0 and counter < 500000
  21. counter = counter + 1
  22. sockval.ConGetData strTemp
  23. strInData = strInData & strTemp
  24. sockval.ConDoEvents
  25. loop
  26. sockval.CloseSock
  27. end if
  28. set sockval = nothing
  29. end if
  30. if IsObject(sockval) then
  31. set sockval = nothing
  32. end if
  33. %>
I am getting the below error

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/ANJ/UNIX/1.asp, line 16

800401f3
Apr 5 '13 #3

P: 11
Any Help Is Really Appreciated
Apr 5 '13 #4

10K+
P: 13,264
Did you install the Winsock Component properly and register it on your server?
Apr 5 '13 #5

P: 11
Yes Sir I Have registered WinSock
Apr 5 '13 #6

Post your reply

Sign in to post your reply or Sign up for a free account.