Winsock control in ASP Page

O

Ophir

Hello all !
I wrote a simple ActiveX DLL to wrap winsock functionality so I can
use it in an ASP page.

I call it MyWinSock

In the Class module I use this declaration:

Dim ctlSocket as Variant.

In the Class_Initialize() I wrote the following:

Set ctlSocket = CreateObject("MSWinsock.Winsock")

Now the problem is: When I make an instance of the class MyWinSock
from another VB program - everything works fine.

When I make an instance of it from IIS on my computer via ASP page -
it works fine.

When I try to make an instance of it from an ASP page located on
another computer via its IIS I get an error:

"MyWinSock (0x800A01AD)
ActiveX component can't create object"

As far as I could understand the error occures when MyWinSock trys to
make an instance of the Winsock object. If I don't try to make an
instance of the Winsock control everything is OK.

I registered the component in the remote computer and checked that all
registery entries for it are correct.

Any help will be appriciated.

Thanks
Ophir.
 
O

Ophir

jenny mabe said:
did you make sure the MSWinsock component is also registered on the serv
er?

take a look at the discussion on this page. it may give you some ideas.
http://www.experts-exchange.com/Programming/Programming Languages/Visual
Basic/Q 20848674.html


jenny


Jenny thanks for the reply.
I sure did make sure that the MSWinsoc is registered on the server computer.
I also use winsock on that computer in other applications and it works fine.
Anymore ideas?
Ophir.
 
J

jenny mabe

I sure did make sure that the MSWinsoc is registered on the server
computer. I also use winsock on that computer in other applications and
it works fine. Anymore ideas?

Can you post the code from the ASP page?


Jenny
 
O

Ophir

jenny mabe said:
Can you post the code from the ASP page?


Jenny

Jenny here is the code:

dim strValueToSend,ctlSocket,strInData,strTemp,counter,strIP,strPort,strWait
Response.Expires = -1000
strValueToSend = Request.QueryString("ATI")

strIP = Request.QueryString("IP")

strPort = Request.QueryString("Port")

strWait = Request.QueryString("Wait")

'Response.Write "Value is before sock : " & strValueToSend & "<BR>"

if strValueToSend <> "" then
set ctlSocket = Server.CreateObject("ConSockLib.ConSock")
'set ctlSocket = Server.CreateObject("MSWinsock.Winsock")
if not ctlSocket.ConnectSock (strIP,Clng(strPort)) then
Response.Write "Failed to connect"
else
'Response.Write "Value is : " & strValueToSend & "<BR>"
ctlSocket.ConSendData strValueToSend & vbCr
do while InStr(1,strInData,strWait,vbTextCompare) = 0 and counter < 500000
counter = counter + 1
ctlSocket.ConGetData strTemp
strInData = strInData & strTemp
ctlSocket.ConDoEvents
loop
ctlSocket.CloseSock
'Response.Write "<PRE>Return value is: " & vbCrLf & strInData & "<PRE>"
end if
set ctlSocket = nothing
end if
if IsObject(ctlSocket) then
set ctlSocket = nothing
end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top