Jump to content

Winsock not listening


Dion

Recommended Posts

I've just converted a smallish VB6 winsock server program to VB 2017.  It's successfully converted to AxMSWinsockLib, and after the usual minor changes to code (non associated with winsock), it compiles and runs, but winsock events don't seem to trigger. Netstat shows that the port is listening and I can see attempted connections from the client (which is still VB6).

The sub definition lines (as created by mobilze) are:

Private Sub Socket_ConnectionRequest(ByVal eventSender As Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_ConnectionRequestEvent) Handles _Socket_0.ConnectionRequest

Private Sub Socket_DataArrival(ByVal eventSender As Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles _Socket_0.DataArrival

Private Sub Socket_CloseEvent(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles _Socket_0.CloseEvent
 

Anyone had similar issues? Is there something obvious I'm missing? Any other ideas? Do I just rewrite to System.Net.Sockets?

Link to comment
Share on other sites

  • Mobilize.Net Staff

Hello Dion,

Do you have a firewall that may be blocking connections attempts? You can try by implementing the winsock error event to trap error messages.

My suggestion given you're now in .Net, replace the winsock by System.Net.Sockets. The communication between .Net and Interop/Activex components my be not as smoothly as expected, so using a pure .Net component could be the best option.

Some guides about .Net sockets:

https://docs.microsoft.com/en-us/dotnet/framework/network-programming/synchronous-client-socket-example 

https://docs.microsoft.com/en-us/dotnet/framework/network-programming/synchronous-server-socket-example

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use