Results 1 to 5 of 5

Thread: TCPIP inside of COM

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    New Jersey
    Posts
    39

    Exclamation TCPIP inside of COM

    I have a current working dll that I need to add TCP/IP socket functionality in. I know to use MSWinSock.dll but how do I reference it? It's not referenceable. DECLARE?

    The TCP/IP fucntionality would be like a Client. I have the code I need to run in a test project but I was using the WinSock control and dumping into my dll was more difficult then I thought.

    I need to send a message to a server and wait for a response.

    Damn, It sounds so simple... any help would be appreciated.

    Shadow

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    add the component


    Dim WithEvents obj As Winsock
    Set obj = New Winsock

    I think that should do it
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    New Jersey
    Posts
    39

    Unhappy I tried that... but this is what I came up with

    Although I do not have a form I added the component as requested. (I don't understand why, BUT... you da man so I'll listen )

    In the General/Declarations I added:

    Dim WithEvents obj as WinSock

    then when I am about to set it up to listen I am setting the object via:

    Set obj = New Winsock.

    ** note that after "New" Winsock does NOT appear in the drop down.

    During compile I get this error:

    ==Compile Error==
    Invalid use of NEW keyword.

    this appears and VB highlighted "New Winsock"

    hmmmm... I do appreciate the go tho

  4. #4
    Addicted Member Janus's Avatar
    Join Date
    Aug 2001
    Location
    California
    Posts
    221
    Make it a reference, not a component.
    remove it from the components and the toolbox, and add it to your references instead. The OCX can act either as a DLL or an OCX, but not both at once.
    "1 4m 4 1337 #4xz0r!'
    Janus

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    New Jersey
    Posts
    39

    OK... So far so good... now...

    ... one more question... I can compile with no problems and everything seems to be working fine... BUT....

    How would I wait for a response from the server. I have set the localport and set to listen but with out any events where can I look for the "DataArrival" event?

    Should I:

    Dim WithEvents obj as Winsock

    Like Cander suggested?

    ne comments welcome....

    Shadow

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