Results 1 to 7 of 7

Thread: "you do not have liscense"

  1. #1

    Thread Starter
    Lively Member morrowasted's Avatar
    Join Date
    Aug 2003
    Location
    Houston, TX
    Posts
    118

    "you do not have liscense"

    I just upgraded to VB.NET and now whenever i attempt to use the MSWNSCK.OCX control (winsock control), i get a "you do not have liscensing permissions blah blah blah".
    How can I fix this?

    -morrowasted

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    MSWNSCK.OCX isn't really destined to be used in vb.net , you should be looking at using System.Net.Sockets
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  3. #3

    Thread Starter
    Lively Member morrowasted's Avatar
    Join Date
    Aug 2003
    Location
    Houston, TX
    Posts
    118
    i'd really like to use the control for a simple test project really quick though..

    how do you use "System.Net.Sockets", im not familiar with these .net things.

    -morrowasted

  4. #4
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    i'd really like to use the control for a simple test project really quick though
    if you got winsock to run in .net it will throw up allsorts of wierd errors , lots of things dont work how they should ( eg: connection request )
    this is an example i found a while back ...
    in a class module:
    VB Code:
    1. [COLOR=BLUE]Imports[/COLOR] System
    2. [COLOR=BLUE]Imports[/COLOR] System.Net
    3. [COLOR=BLUE]Imports[/COLOR] System.Net.Sockets
    4. [COLOR=BLUE]Imports[/COLOR] System.Text
    5.  
    6. [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Class[/COLOR] StateObject
    7.     [COLOR=BLUE]Public[/COLOR] workSocket [COLOR=BLUE]As[/COLOR] Socket = [COLOR=BLUE]Nothing
    8. [/COLOR]    [COLOR=BLUE]Public[/COLOR] BufferSize [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Integer[/COLOR] = 32767
    9.     [COLOR=BLUE]Public[/COLOR] buffer(32767) [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Byte
    10. [/COLOR]    [COLOR=BLUE]Public[/COLOR] sb [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]New[/COLOR] StringBuilder()
    11. [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Class
    12.  
    13. Public[/COLOR] [COLOR=BLUE]Class[/COLOR] SocketsClient
    14.     [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Event[/COLOR] onConnect()
    15.     [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Event[/COLOR] onError([COLOR=BLUE]ByVal[/COLOR] Description [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]String[/COLOR])
    16.     [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Event[/COLOR] onDataArrival([COLOR=BLUE]ByVal[/COLOR] Data [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Byte[/COLOR](), [COLOR=BLUE]ByVal[/COLOR] TotalBytes [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Integer[/COLOR])
    17.     [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Event[/COLOR] onDisconnect()
    18.     [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Event[/COLOR] onSendComplete([COLOR=BLUE]ByVal[/COLOR] DataSize [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Integer[/COLOR])
    19.  
    20.     [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Shared[/COLOR] response [COLOR=BLUE]As[/COLOR] [String] = [String].Empty
    21.     [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Shared[/COLOR] port [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Integer[/COLOR] = 44
    22.     [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Shared[/COLOR] ipHostInfo [COLOR=BLUE]As[/COLOR] IPHostEntry = Dns.Resolve("localhost")
    23.     [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Shared[/COLOR] ipAddress [COLOR=BLUE]As[/COLOR] ipAddress = ipHostInfo.AddressList(0)
    24.     [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Shared[/COLOR] client [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]New[/COLOR] Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
    25.     [COLOR=GREEN]'Private Shared RawClient As New Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Raw)
    26. [/COLOR]    [COLOR=GREEN]'//raw socket^^
    27. [/COLOR]    [COLOR=GREEN]'/// ignore this.
    28. [/COLOR]    [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Sub[/COLOR] Connect([COLOR=BLUE]ByVal[/COLOR] RemoteHostName [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]String[/COLOR], [COLOR=BLUE]ByVal[/COLOR] RemotePort [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Integer[/COLOR])
    29.         [COLOR=BLUE]Try
    30. [/COLOR]            [COLOR=GREEN]'RawClient = New Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Raw)
    31. [/COLOR]            client = [COLOR=BLUE]New[/COLOR] Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
    32.             port = RemotePort
    33.             ipHostInfo = Dns.Resolve(RemoteHostName)
    34.             ipAddress = ipHostInfo.AddressList(0)
    35.             [COLOR=BLUE]Dim[/COLOR] remoteEP [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]New[/COLOR] IPEndPoint(ipAddress, port)
    36.             client.BeginConnect(remoteEP, [COLOR=BLUE]AddressOf[/COLOR] sockConnected, client)
    37.             [COLOR=GREEN]'RawClient.BeginConnect(remoteEP, AddressOf sockConnected, RawClient)
    38. [/COLOR]        [COLOR=BLUE]Catch
    39. [/COLOR]            [COLOR=BLUE]RaiseEvent[/COLOR] onError(Err.Description)
    40.             [COLOR=BLUE]Exit[/COLOR] [COLOR=BLUE]Sub
    41. [/COLOR]        [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Try
    42. [/COLOR]    [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Sub
    43.  
    44. [/COLOR]    [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Sub[/COLOR] SendData([COLOR=BLUE]ByVal[/COLOR] Data() [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Byte[/COLOR])
    45.         [COLOR=BLUE]Try
    46. [/COLOR]            [COLOR=BLUE]Dim[/COLOR] byteData [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Byte[/COLOR]() = Data
    47.             client.BeginSend(byteData, 0, byteData.Length, 0, [COLOR=BLUE]AddressOf[/COLOR] sockSendEnd, client)
    48.             [COLOR=GREEN]'RawClient.BeginSend(byteData, 0, byteData.Length, 0, AddressOf sockSendEnd, RawClient)
    49. [/COLOR]        [COLOR=BLUE]Catch
    50. [/COLOR]            [COLOR=BLUE]RaiseEvent[/COLOR] onError(Err.Description)
    51.             [COLOR=BLUE]Exit[/COLOR] [COLOR=BLUE]Sub
    52. [/COLOR]        [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Try
    53. [/COLOR]    [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Sub
    54.  
    55. [/COLOR]    [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Sub[/COLOR] Disconnect()
    56.         [COLOR=BLUE]Try
    57. [/COLOR]            client.Shutdown(SocketShutdown.Both)
    58.         [COLOR=BLUE]Catch
    59. [/COLOR]        [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Try
    60. [/COLOR]        client.Close()
    61.     [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Sub
    62.  
    63. [/COLOR]    [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Function[/COLOR] StringToBytes([COLOR=BLUE]ByVal[/COLOR] Data [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]String[/COLOR]) [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Byte[/COLOR]()
    64.         StringToBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(Data)
    65.     [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Function
    66.  
    67. [/COLOR]    [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Function[/COLOR] BytestoString([COLOR=BLUE]ByVal[/COLOR] Data [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Byte[/COLOR]()) [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]String
    68. [/COLOR]        BytestoString = System.Text.ASCIIEncoding.ASCII.GetString(Data)
    69.     [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Function
    70.  
    71. [/COLOR]    [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Sub[/COLOR] sockConnected([COLOR=BLUE]ByVal[/COLOR] ar [COLOR=BLUE]As[/COLOR] IAsyncResult)
    72.         [COLOR=BLUE]Try
    73. [/COLOR]            [COLOR=BLUE]If[/COLOR] client.Connected = [COLOR=BLUE]False[/COLOR] [COLOR=BLUE]Then[/COLOR] [COLOR=BLUE]RaiseEvent[/COLOR] onError("Connection refused.") : [COLOR=BLUE]Exit[/COLOR] [COLOR=BLUE]Sub
    74. [/COLOR]            [COLOR=BLUE]Dim[/COLOR] state [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]New[/COLOR] StateObject()
    75.             state.workSocket = client
    76.             client.BeginReceive(state.buffer, 0, state.BufferSize, 0, [COLOR=BLUE]AddressOf[/COLOR] sockDataArrival, state)
    77.             [COLOR=BLUE]RaiseEvent[/COLOR] onConnect()
    78.         [COLOR=BLUE]Catch
    79. [/COLOR]            [COLOR=BLUE]RaiseEvent[/COLOR] onError(Err.Description)
    80.             [COLOR=BLUE]Exit[/COLOR] [COLOR=BLUE]Sub
    81. [/COLOR]        [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Try
    82. [/COLOR]    [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Sub
    83.  
    84. [/COLOR]    [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Sub[/COLOR] sockDataArrival([COLOR=BLUE]ByVal[/COLOR] ar [COLOR=BLUE]As[/COLOR] IAsyncResult)
    85.         [COLOR=BLUE]Dim[/COLOR] state [COLOR=BLUE]As[/COLOR] StateObject = [COLOR=BLUE]CType[/COLOR](ar.AsyncState, StateObject)
    86.         [COLOR=BLUE]Dim[/COLOR] client [COLOR=BLUE]As[/COLOR] Socket = state.workSocket
    87.         [COLOR=BLUE]Dim[/COLOR] bytesRead [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Integer
    88.  
    89. [/COLOR]        [COLOR=BLUE]Try
    90. [/COLOR]            bytesRead = client.EndReceive(ar)
    91.         [COLOR=BLUE]Catch
    92. [/COLOR]            [COLOR=BLUE]Exit[/COLOR] [COLOR=BLUE]Sub
    93. [/COLOR]        [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Try
    94.  
    95. [/COLOR]        [COLOR=BLUE]Try
    96. [/COLOR]            [COLOR=BLUE]Dim[/COLOR] Data() [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Byte[/COLOR] = state.buffer
    97.             [COLOR=BLUE]If[/COLOR] bytesRead = 0 [COLOR=BLUE]Then
    98. [/COLOR]                client.Shutdown(SocketShutdown.Both)
    99.                 client.Close()
    100.                 [COLOR=BLUE]RaiseEvent[/COLOR] onDisconnect()
    101.                 [COLOR=BLUE]Exit[/COLOR] [COLOR=BLUE]Sub
    102. [/COLOR]            [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]If
    103. [/COLOR]            [COLOR=BLUE]ReDim[/COLOR] state.buffer(32767)
    104.  
    105.             client.BeginReceive(state.buffer, 0, state.BufferSize, 0, [COLOR=BLUE]AddressOf[/COLOR] sockDataArrival, state)
    106.             [COLOR=BLUE]RaiseEvent[/COLOR] onDataArrival(Data, bytesRead)
    107.         [COLOR=BLUE]Catch
    108. [/COLOR]            [COLOR=BLUE]RaiseEvent[/COLOR] onError(Err.Description)
    109.             [COLOR=BLUE]Exit[/COLOR] [COLOR=BLUE]Sub
    110. [/COLOR]        [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Try
    111. [/COLOR]    [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Sub
    112.  
    113. [/COLOR]    [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Sub[/COLOR] sockSendEnd([COLOR=BLUE]ByVal[/COLOR] ar [COLOR=BLUE]As[/COLOR] IAsyncResult)
    114.         [COLOR=BLUE]Try
    115. [/COLOR]            [COLOR=BLUE]Dim[/COLOR] client [COLOR=BLUE]As[/COLOR] Socket = [COLOR=BLUE]CType[/COLOR](ar.AsyncState, Socket)
    116.             [COLOR=BLUE]Dim[/COLOR] bytesSent [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Integer[/COLOR] = client.EndSend(ar)
    117.             [COLOR=BLUE]RaiseEvent[/COLOR] onSendComplete(bytesSent)
    118.         [COLOR=BLUE]Catch
    119. [/COLOR]            [COLOR=BLUE]RaiseEvent[/COLOR] onError(Err.Description)
    120.             [COLOR=BLUE]Exit[/COLOR] [COLOR=BLUE]Sub
    121. [/COLOR]        [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Try
    122. [/COLOR]    [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Sub
    123.  
    124. [/COLOR]    [COLOR=BLUE]Public[/COLOR] [COLOR=BLUE]Function[/COLOR] Connected() [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Boolean
    125. [/COLOR]        [COLOR=BLUE]Try
    126. [/COLOR]            [COLOR=BLUE]Return[/COLOR] client.Connected
    127.         [COLOR=BLUE]Catch
    128. [/COLOR]            [COLOR=BLUE]RaiseEvent[/COLOR] onError(Err.Description)
    129.             [COLOR=BLUE]Exit[/COLOR] [COLOR=BLUE]Function
    130. [/COLOR]        [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Try
    131. [/COLOR]    [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Function
    132. End[/COLOR] [COLOR=BLUE]Class
    133. [/COLOR]
    then in your form:
    VB Code:
    1. [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]WithEvents[/COLOR] Client [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]New[/COLOR] SocketsClient()
    then you can use the events as you would with winsock.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  5. #5

    Thread Starter
    Lively Member morrowasted's Avatar
    Join Date
    Aug 2003
    Location
    Houston, TX
    Posts
    118
    damn. ok then thanks lemme give that code a try. i wonder why they took out winsock. many of the controls dont seem to be working, the Database control, the Inet control.... wierd.

    well thanks for the code.

    -morrowasted

  6. #6
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622
    This file will fix your Licenceing problems...

    (Located on VSENARD2\Extras\VB6 Controls)

    Just merge it into your registry and add the controls to ur project
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  7. #7
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382
    Originally posted by morrowasted
    damn. ok then thanks lemme give that code a try. i wonder why they took out winsock. many of the controls dont seem to be working, the Database control, the Inet control.... wierd.

    well thanks for the code.
    I suggest taking a few days and familiarizing yourself with the Net portion of .Net, you will find that after you get comfortable with it, it puts the winsock control to shame.. You have alot more control over things using the Frameworks sockets. Once you get it, spend a couple hours and write yourself a nice little reusable socket component and you won't ever have to fuss with it again..

    Just my 1/2-a cent on the matter... I too missed the winsock control at first but now I prefer the sockets over the control..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width