Results 1 to 5 of 5

Thread: Simple Winsock Question

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54

    Simple Winsock Question

    Hey,
    I'm trying to use this winsock control. And I get so far as this.

    On the receiving computer it performs the Connection request.
    But the DataArrival condition never executes..

    I'm just following that article on winsock controls.. i can send the code if it helps.

  2. #2
    Lively Member
    Join Date
    Sep 2001
    Location
    Berkshire
    Posts
    121
    I take it you are listening to the right port?
    Posting some code would help, yes.

  3. #3
    Lively Member
    Join Date
    Aug 2000
    Location
    Trondheim, Norway
    Posts
    65
    The server app must send something, for the client app to recieve.

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    If you are using the example in Karl Moore's article, the problem is with these 2 lines of code:
    Code:
    Winsock1.SendData (txtMessage.Text)
    
    Winsock1.Close
    You must allow the send enough time to complete before closing the socket.

    If you are interested, I can send you an example client/server app that I wrote to help new winsock users. It is heavily commented, it displays connection states in the form's caption and results in form labels. It also demonstrates how to pass records (aka UDTs) and how to set a time limit when waiting on replys. The server uses 2 socket controls, 1 to listen and one for connecting & sending/receiving data.

  5. #5
    Hyperactive Member kleptos's Avatar
    Join Date
    Aug 2001
    Location
    The Dark Carnival
    Posts
    346
    I havent seen the code, so i am gonna do this from a general case that i use. Are you getting the data using the winsock1.getdata command?

    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    Dim strDataStream as String

    Winsock1.getData strDataStream
    MsgBox strDataStream
    End Sub

    of course you can do just about anything with the strDataStream but thats whats coming accross the connection.
    ..::[kleptos]::..
    • Database Administrator (MSSQL 2000)
    • Application Developer (C#)
    • Web Developer (ASP.NET)


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