|
-
Dec 22nd, 2001, 09:19 AM
#1
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!
-
Dec 22nd, 2001, 09:27 AM
#2
Lively Member
Do the server and client attempt to connect immediatly after they are run or does the user start the connection?
-
Dec 22nd, 2001, 09:54 AM
#3
They never "connect" the server just sends a small string every two seconds.
-
Dec 22nd, 2001, 09:57 AM
#4
Lively Member
i dont see what is wrong then, it should work. Anyone?
-
Dec 22nd, 2001, 12:23 PM
#5
Hyperactive Member
they dont connect?
Without some sort of connection or connection attempt, how do you know anything is working at all?
-
Dec 22nd, 2001, 01:39 PM
#6
Fanatic Member
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:
Private Sub Winsock1_ConnectionRequest(Index As Integer, ByVal requestID As Long)
If Winsock1(Index).State <> sckClosed Then
Winsock1(Index).Close
End If
'plus all other connection code
End Sub
-
Dec 22nd, 2001, 02:11 PM
#7
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|