Create a new vb .exe project, add winsock control to
project. (I am using VB 6.0 SP5) Create two winsock
controls on the form, one named Server, one named Client.
Paste following test code in to the forms code.
<><><><> START OF TEST CODE <><><><>
Option Explicit
Private Sub Client_DataArrival(ByVal bytesTotal As Long)
Dim sMsg As String
Client.GetData sMsg
MsgBox sMsg, , "Client Received"
End Sub
Private Sub Client_Error(ByVal Number As Integer,
Description As String, ByVal Scode As Long, ByVal Source
As String, ByVal HelpFile As String, ByVal HelpContext As
Long, CancelDisplay As Boolean)
CancelDisplay = True
MsgBox "Client_Error occured!"
End Sub
Private Sub Form_Load()
Server.Protocol = sckUDPProtocol
Server.LocalPort = 3604
Client.Protocol = sckUDPProtocol
Client.LocalPort = 4063
Client.RemoteHost = Server.LocalIP
Client.RemotePort = Server.LocalPort
Client.SendData "What we have here is a failure to
c'mun'cate!"
End Sub
Private Sub Server_DataArrival(ByVal bytesTotal As Long)
Dim sMsg As String
Server.GetData sMsg
MsgBox sMsg, , "Server Received"
End Sub
Private Sub Server_Error(ByVal Number As Integer,
Description As String, ByVal Scode As Long, ByVal Source
As String, ByVal HelpFile As String, ByVal HelpContext As
Long, CancelDisplay As Boolean)
CancelDisplay = True
MsgBox "Server_Error occured!"
End Sub
<><><><> END OF TEST CODE <><><><>
Now run it. You will get a VB error as described in:
KB Article: BUG: Winsock Control Run-Time Error 10054 in
DataArrival Event for UDP (Q260018)
Problem: I am running on XP Pro, and not Windows 2000. In
any event this is not the show stopper. The show stopper
is why I get this error in the first place?
KB Article: FIX: Client Winsock Control Never Connects to
Server Control on Same Form (Q257728)
Discribes what is happening perfectly. However, it says
it's FIXED and I should just install the latest Visual
Studio service pack. Unfortunately I am already at SP5!
Can anyone help? This is a show stopper for my newest
application. I expect to be able to communicate via UDP
between the app running as a server & client
simultaneously while also doing UDP communcations to
other "remote" clients.
Regards,
Erin