Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

CSocketMaster & Vista incompatible??

c0sm1cSlug

New member
Joined
Jan 24, 2008
Messages
7
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.
 

RobDog888

Super Moderator
Joined
Apr 13, 2001
Messages
60,708
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.
 

c0sm1cSlug

New member
Joined
Jan 24, 2008
Messages
7
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 :(
 

Doogle

PowerPoster
Joined
Jul 4, 2006
Messages
6,334
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
 

c0sm1cSlug

New member
Joined
Jan 24, 2008
Messages
7
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!!! :cry:
 

Doogle

PowerPoster
Joined
Jul 4, 2006
Messages
6,334
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
 

michaelhorne

New member
Joined
Jul 12, 2008
Messages
1
c0sm1cSlug said:
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!!! :cry:

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.
 

c0sm1cSlug

New member
Joined
Jan 24, 2008
Messages
7
michaelhorne said:
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
 

escape2mtns

New member
Joined
Mar 20, 2010
Messages
1
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"
 

Apollogz

New member
Joined
Jul 11, 2016
Messages
2
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.
 
Top