Results 1 to 11 of 11

Thread: CSocketMaster & Vista incompatible??

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    7

    Question CSocketMaster & Vista incompatible??

    I use the winsock-wrapper 'CSocketMaster' in alot of my code, since switching to vista I noticed it would no longer work, well refuses to connect to connect, throwing the error "cannot assign requested address".
    I've tried both the version available at http://www.geocities.com/anshoku/ and http://www.pscode.com/vb. Neither worked, but both will function fine in my XP virtual machine!

    Has anyone else noticed this or is it just me? I'm thinking maybe the winsock API changed but I hav'nt heard anything about that.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: CSocketMaster & Vista incompatible??

    Welcome to the Forums.

    Are you running that process elevated as Administrator? It may be one of Vistas new security enhancements that is preventing the assignment.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    7

    Re: CSocketMaster & Vista incompatible??

    I have tried running both the visualbasic ide & the compiled project as administrator. the application seems to compile fine, but crashes on using the class.
    the project wont crash in the ide though, it raises the error event. with my previously mentioned description.

    This has really stumped me, I use this class in so many of my projects

  4. #4
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: CSocketMaster & Vista incompatible??

    I don't think the Winsock APIs have changed significantly. I have just tried loading a Project using Winsock onto my Vista Machine and it works fine. (However, I did get some errors when loading the project "Unable to access Registry" and the Winsock control went missing form my form. I just re-drew one on the Form and it worked OK.)

    I haven't got much knowledge about Vista yet, but I wonder if it's sensitive about which Port(s) you use

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    7

    Re: CSocketMaster & Vista incompatible??

    thanks for your reply Doogle, I think you misunderstood though.
    I can use the winsock activex controll fine in both Vista and XP.

    What I'm having trouble using is 'CSocketMaster' A class module for the winsock API, not the activex control. (i dislike having to bundle .ocx's)

    CSocketMaster was coded well before Vista was cooked-up, and I fear its now incompatible, which is a shame because its one of my most re-used codes

    Just incase the issue could be the port.. I'm tryin to connect to port 80 on my LAN Router to create my own webadmin application. I see no reason why vista would disallow that and I can access the webadmin page fine in firefox/ie by the way.

    Visit the geocities url for more infomation on the class if you havn't heard of it, I really hope someone can solve this for me!!!

  6. #6
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: CSocketMaster & Vista incompatible??

    The only other suggestion I have, is to see if you can access the LAN Router on Port 80 with Winsock. If you can then it's probably a CSocketMaster / Vista incompatibility, if you can't then it's a Vista issue.
    Code:
    Private Sub Command1_Click()
    Winsock1.RemoteHost = "<Router IP Address>"
    Winsock1.RemotePort = 80
    Winsock1.Connect
    End Sub
    
    Private Sub Winsock1_Connect()
    MsgBox "Connected"
    End Sub
    
    Private Sub Winsock1_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)
    MsgBox "Error " & Number & " whilst attempting conection (" & Description & ")"
    End Sub

  7. #7
    New Member
    Join Date
    Jul 2008
    Posts
    1

    Re: CSocketMaster & Vista incompatible??

    Quote Originally Posted by c0sm1cSlug
    thanks for your reply Doogle, I think you misunderstood though.
    I can use the winsock activex controll fine in both Vista and XP.

    What I'm having trouble using is 'CSocketMaster' A class module for the winsock API, not the activex control. (i dislike having to bundle .ocx's)

    CSocketMaster was coded well before Vista was cooked-up, and I fear its now incompatible, which is a shame because its one of my most re-used codes

    Just incase the issue could be the port.. I'm tryin to connect to port 80 on my LAN Router to create my own webadmin application. I see no reason why vista would disallow that and I can access the webadmin page fine in firefox/ie by the way.

    Visit the geocities url for more infomation on the class if you havn't heard of it, I really hope someone can solve this for me!!!
    Hi. Is it all ports that comes up with this error? Try listening on a different port and connecting with csocketmaster. I think your find it's your AV if you have any installed. Disable it and see. My symantec internet messaging monitor was stopping mine.

  8. #8
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: CSocketMaster & Vista incompatible??

    have you tried emailing the author?

    [email protected]
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  9. #9

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    7

    Re: CSocketMaster & Vista incompatible??

    Quote Originally Posted by michaelhorne
    Hi. Is it all ports that comes up with this error? Try listening on a different port and connecting with csocketmaster. I think your find it's your AV if you have any installed. Disable it and see. My symantec internet messaging monitor was stopping mine.
    Its not just listening, its connecting too. its not my AC or firewall, its 100% vista.. I am successfully running/debugging my applications in a windows xp virtual machine right now.

    for anyone still interested, the only working winsock replacement class that is vista compatible is at http://www.vbforums.com/showthread.php?t=534580 although it is a work in progress still it looks promising

  10. #10
    New Member
    Join Date
    Mar 2010
    Posts
    1

    Re: CSocketMaster & Vista incompatible??

    I was having the same problem with CSocketMaster on Windows Server 2008.

    CSocketMaster, when making an outbound connection will 'bind' the port, I watched the winsock logs and noticed that Vista changed the protocol to UDP at that point. When the computer has more than one NIC, windows isn't good at getting the "Local IP" that's used to set the source port for the bind call. So I think what was happening is that bind was using a different IP than the one windows wanted to route the request through. Vista has new socket security to prevent IP spoofing and that somehow gets involved. It may also be that vista only allows you to bind outbound UDP connections.

    Either way... I fixed this by changing the following code in CSocketMaster's Connect function from:

    ----------------------------------------

    'create a socket if there isn't one yet
    If Not SocketExists Then Exit Sub

    'Here we bind the socket
    If Not BindInternal Then Exit Sub

    ----------------------------------------
    to:
    ----------------------------------------

    'create a socket if there isn't one yet
    If Not SocketExists Then Exit Sub

    ' Vista fix 3/19/2010 - only bind if UDP
    If m_enmProtocol = sckUDPProtocol Then
    'Here we bind the socket
    If Not BindInternal Then Exit Sub
    End If

    -----------------------------------------

    I also changed a line at the top of the GetLocalIP function (but I don't think it was relevant). I commented out the assignment for strLocalHost and replaced it with the line below so that hopefully vista (or server 2008 for me) would select the correct ip for the outbound request.


    strLocalHost = "0.0.0.0"

  11. #11
    New Member
    Join Date
    Jul 2016
    Posts
    2

    Re: CSocketMaster & Vista incompatible??

    Quote Originally Posted by c0sm1cSlug View Post
    I use the winsock-wrapper 'CSocketMaster' in alot of my code, since switching to vista I noticed it would no longer work, well refuses to connect to connect, throwing the error "cannot assign requested address".
    I've tried both the version available at http://www.geocities.com/anshoku/ and http://www.pscode.com/vb. Neither worked, but both will function fine in my XP virtual machine!

    Has anyone else noticed this or is it just me? I'm thinking maybe the winsock API changed but I hav'nt heard anything about that.
    The issue for me was Vista/Win 7/Win 2K8 Data Execution Prevention during the winsock API connect routine. Adding your executable to the exclusion list for DEP or switching DEP to protect only system resources fixes the issue.

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