Results 1 to 4 of 4

Thread: Connect to host

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Location
    Kuala Lumpur
    Posts
    12

    Exclamation

    Hi All,
    Anyone, please please help.......

    The scenario :
    1)The host/remote side have their own application to transmit and receive data.
    2) I have a PC at my site, my PC have to send some message to host thru TCP/IP .

    Question:
    I understand that winsock have to have both server and client install in oder for them to connect. But i can't install any application at their side,
    So, is that a way for me to connect in VB without install any application at their side? How to detect the data arrive? And how to sent out the data from my application?

    What is the thing that i need to take into consideration in order for me to connect to host?

    Thanks ..

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    To make a TCP conneciton there must be something listening on a tcp port on the remote side, and something willing to connect from the client.

    So if you were to connect your mail client to the ftp port of a server, you would have a TCP connection.

    So all you have to do is connect and send the required data ...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2001
    Location
    Kuala Lumpur
    Posts
    12
    But my problem is i don't even know what to use in order to connect, may be winsock, mscomm.....

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    You would use a winsock control.
    Personally I use the microsoft winsock control.

    You can use it by going,
    Project > Components > Microsoft Winsock Control

    Then stick it on your form.
    Give it a remotehost + remoteport property.
    Then to make it connect, you just do :

    Code:
    Winsock1.Connect
    All of the events for the winsock control are pretty straightforward.
    And to grab data coming into the winsock control you'd do something like this :

    Code:
    Dim strString As String
    
    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
        Winsock1.GetData strString, vbString
        'strString now contains the data that came in
    End Sub
    That help clear things up ?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

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