Winsock control in ASP Page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ophir

    Winsock control in ASP Page

    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_Initializ e() I wrote the following:

    Set ctlSocket = CreateObject("M SWinsock.Winsoc k")

    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.
  • jenny mabe

    #2
    Re: Winsock control in ASP Page

    On 25 Feb 2004 05:45:12 -0800, Ophir <ophirbb@netvis ion.net.il> wrote:
    [color=blue]
    > 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"[/color]

    did you make sure the MSWinsock component is also registered on the server?

    take a look at the discussion on this page. it may give you some ideas.



    jenny

    Comment

    • Ophir

      #3
      Re: Winsock control in ASP Page

      jenny mabe <news@rabidduck .com> wrote in message news:<opr3xw2ei 5qafk40@localho st>...[color=blue]
      > On 25 Feb 2004 05:45:12 -0800, Ophir <ophirbb@netvis ion.net.il> wrote:
      >[color=green]
      > > 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"[/color]
      >
      > 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[/color]


      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.

      Comment

      • jenny mabe

        #4
        Re: Winsock control in ASP Page

        On 25 Feb 2004 23:33:49 -0800, Ophir <ophirbb@netvis ion.net.il> wrote:
        [color=blue]
        > 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?[/color]

        Can you post the code from the ASP page?


        Jenny

        Comment

        • Ophir

          #5
          Re: Winsock control in ASP Page

          jenny mabe <news@rabidduck .com> wrote in message news:<opr3yvfub 4qafk40@localho st>...[color=blue]
          > On 25 Feb 2004 23:33:49 -0800, Ophir <ophirbb@netvis ion.net.il> wrote:
          >[color=green]
          > > I sure did make sure that the MSWinsoc is registered on the server[/color]
          >[color=green]
          > > computer. I also use winsock on that computer in other applications an[/color]
          > d
          >[color=green]
          > > it works fine. Anymore ideas?[/color]
          >
          > Can you post the code from the ASP page?
          >
          >
          > Jenny[/color]

          Jenny here is the code:

          dim strValueToSend, ctlSocket,strIn Data,strTemp,co unter,strIP,str Port,strWait
          Response.Expire s = -1000
          strValueToSend = Request.QuerySt ring("ATI")

          strIP = Request.QuerySt ring("IP")

          strPort = Request.QuerySt ring("Port")

          strWait = Request.QuerySt ring("Wait")

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

          if strValueToSend <> "" then
          set ctlSocket = Server.CreateOb ject("ConSockLi b.ConSock")
          'set ctlSocket = Server.CreateOb ject("MSWinsock .Winsock")
          if not ctlSocket.Conne ctSock (strIP,Clng(str Port)) then
          Response.Write "Failed to connect"
          else
          'Response.Write "Value is : " & strValueToSend & "<BR>"
          ctlSocket.ConSe ndData strValueToSend & vbCr
          do while InStr(1,strInDa ta,strWait,vbTe xtCompare) = 0 and counter < 500000
          counter = counter + 1
          ctlSocket.ConGe tData strTemp
          strInData = strInData & strTemp
          ctlSocket.ConDo Events
          loop
          ctlSocket.Close Sock
          'Response.Write "<PRE>Retur n value is: " & vbCrLf & strInData & "<PRE>"
          end if
          set ctlSocket = nothing
          end if
          if IsObject(ctlSoc ket) then
          set ctlSocket = nothing
          end if

          Comment

          Working...