Results 1 to 7 of 7

Thread: Winsock

  1. #1
    etoo
    Guest

    Winsock

    Hello!

    I have a problem using Winsock with my application.

    I'm using the UDP protocol.

    I have two programs, the client and the server.

    The server sends data every 2 seconds.

    If I start the server first and then the client, it works.

    But, if I start the client first, it does not get the data.

    Likewise, if I exit the server and then reload it, the client does not get the data.

    Why is this?

    Thanks!

  2. #2
    Lively Member d4v3's Avatar
    Join Date
    Nov 2001
    Location
    Leicester, UK
    Posts
    82
    Do the server and client attempt to connect immediatly after they are run or does the user start the connection?

  3. #3
    etoo
    Guest
    They never "connect" the server just sends a small string every two seconds.

  4. #4
    Lively Member d4v3's Avatar
    Join Date
    Nov 2001
    Location
    Leicester, UK
    Posts
    82
    i dont see what is wrong then, it should work. Anyone?

  5. #5
    Hyperactive Member Eyes.Only's Avatar
    Join Date
    Oct 2001
    Location
    Minnesota
    Posts
    347
    they dont connect?

    Without some sort of connection or connection attempt, how do you know anything is working at all?

  6. #6
    Fanatic Member stickman373's Avatar
    Join Date
    Mar 2001
    Location
    MA
    Posts
    909

    Re: Winsock

    Originally posted by etoo


    If I start the server first and then the client, it works.

    But, if I start the client first, it does not get the data.

    Likewise, if I exit the server and then reload it, the client does not get the data.

    Why is this?

    Thanks!
    perhaps the reason for it not working after reload is the winsock wasn't closed? Make the code close the winsock on connection if it is not used anymore something like this:

    VB Code:
    1. Private Sub Winsock1_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    2.  
    3. If Winsock1(Index).State <> sckClosed Then
    4.         Winsock1(Index).Close
    5. End If
    6. 'plus all other connection code
    7. End Sub

  7. #7
    Lively Member
    Join Date
    Nov 2001
    Location
    dev/null
    Posts
    64
    In general, you should use the TCP protocol when you need a client-server relationship.

    If you absolutely *have* to use UDP, make sure that your RemotePort and Bind settings are set up correctly when both the server program and client program load.

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