Winsock control issues 
Author Message
 Winsock control issues

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



Mon, 26 Jul 2004 13:13:02 GMT  
 Winsock control issues

Hello,

My name is Jian-Wei Yu. Thank you for using the Microsoft VB Newsgroups.

Please test the solution in Q260018.

Windows XP is based on the Windows 2000 code base.

Hope it helps. If you have any questions, please reply to this post.

Best Regards,  

Jian-Wei Yu
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.



Tue, 27 Jul 2004 16:41:04 GMT  
 Winsock control issues
Jian-Wei

Actually my whole problem stemmed from the fact that even
if using UDP you have to Bind to the port. You do not have
to Listen on the port- but you do have to Bind. As for the
error function not getting called- it's still a problem,
but at least one I can work around.

Regards,
Erin.



Fri, 30 Jul 2004 22:47:48 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Winsock Control Issue

2. Rentrancy issue with the Winsock control

3. Winsock control redistribution issues ??

4. Winsock issues...

5. Winsock application issue: NEED HELP

6. Winsock issue

7. Winsock Issue - need help

8. Winsock application issue: NEED HELP!!!

9. Reconnection issue between Winsock Server(VB6) and TCP Client (VB.NET)

10. VB6 Winsock Control vs. Winsock API

11. Winsock Control Error 2 winsock.listen

12. WinSock control CPU hog and gimme WinSock API! :)

 

 
Powered by phpBB® Forum Software