Results 1 to 3 of 3

Thread: What is wrong with this program

  1. #1
    Guest

    Post

    Here is the code...it is supposed to connect to the server and display "Hello World" when it connects to the server, All it does is keep the Command1 button disabled. Please help!!!

    Option Explicit
    Private Sub Command1_Click()
    Winsock1.SendData "Hello World"
    End Sub
    Private Sub Form_Load()
    Command1.Enabled = False
    Winsock1.Connect InputBox$("Enter Server name:"), 7

    End Sub
    Private Sub form_unload(Cancel As Integer)
    Winsock1.Close
    End Sub

    Private Sub winsock1_connect()
    Command1.Enabled = True
    End Sub

    Private Sub winsock1_dataarrival(ByVal bytestotal As Long)
    Dim temp As String
    temp = String(bytestotal, Chr$(0))
    Winsock1.GetData temp, vbString, bytestotal
    MsgBox "hello"
    End Sub

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    What are you trying to Connect to?
    It's likely that the Server isn't Listening on Port 7

    Also, When Sending Data be sure to terminate the Data with a vbCrLf or it won't actually get processed, ie.

    Winsock1.SendData "Hello" & vbCrLf



    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Certified AllExperts Expert

  3. #3
    Guest

    Post

    I'm trying to connect to the server using TCP/IP but it isn't connecting. How could I set the code up to send data to a port on the server that was listening, or how could I set up the server to listen for the data?

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