Tasslehoof
asked on
VB6 Sockets: I get error 10055 (No buffer space available) under Win98 BUT not under WinNt.
I made a sort of chatlike program in VB6.0, with an array of 32 winsockets. At program startup, all the 32 sockets are set to .Listen. It works fine on all the different PC's in my company running NT 4.0 SP6a, but on all the machines running 98 SE I get the abovementioned error. I raised the buffers to 100 in config.sys, and it didn't work. Think it's not the same buffers the error refers to. So, any suggestion?
ASKER
Nope, as I said, @ the start of the program all the winsocks are set to .Listen, and the program doesn't do anything until one of the sockets receives a ConnectionRequest event. No connection requests happen, the program fails to run on startup with that error
ASKER
Problem is, I'd need to install VB6 on one of those machines and run the prog in interpreted mode, but it bugs me! :)
my suggestion to you, make sure all the computers have Winsock 2.
-Brian
-Brian
I think 98SE had Winsock 1.1
ASKER
Ty, I'll have a look on Monday and tell you what I find (I'm in Italy, so I guess the time difference is about 8 hrs ?)
ASKER
I did a package of my program, using the utility in the Professional version of VB6, and installed it on the W98 PC's, therefore the winsocket control (Mswinsck.ocx V. 6.00.8988) should, and indeed is (I've checked), be installed in the system directory.
In the Form_Load event of my starting Form, I initialize the 32 sockets to .Listen, I've added an error-trapping thinghy there, and the error happens on the 18th socket . Some code? OK.
' in a module:
' ---------------
Public Const MAXSCK = 31
Public Const PORT1 = 4040
' The Form_Load event of the Startup Object:
' --------------------------
Private Sub Form_Load()
Dim i
On Error GoTo err_h
For i = 0 To MAXSCK
With Sck(i)
.LocalPort = PORT1 + i
.Listen
End With
Next
Exit Sub
err_h:
MsgBox Err.Description, vbCritical, "Socket " & i
Resume Next
End Sub
' And the output says "Socket 17" in the title of the MsgBox (the prompt being the known error).
' Of course, the various Sck(i) are part of an array of Winsockets controls put on the form manually (i.e., I didn't DIM them as
' objects: I phisically put them on the Form)
Does that help at all?
ASKER
P.S.: The FIRST error is on the 18th socket, it obviously repeates itself till the last (the 32nd)
:) Since you are Makind a Chat application it's Better to Just put ONE winsock control ONLY and use the UDP Protocol ...
then let the Winsock set the RemoteIP to 255.255.255.255 and the RemotePort to a Fixed Port like 4040
Using UDP and Sending a Message to 255.255.255.255 will BroadCast the Message to all PCS on the network Listening on your same Port ...
I know this routine is different than ur Current one But i felt in the same before so i Switched to UDP which i don't Like :P LOL
Let me know if you need Further help...
OHDev
then let the Winsock set the RemoteIP to 255.255.255.255 and the RemotePort to a Fixed Port like 4040
Using UDP and Sending a Message to 255.255.255.255 will BroadCast the Message to all PCS on the network Listening on your same Port ...
I know this routine is different than ur Current one But i felt in the same before so i Switched to UDP which i don't Like :P LOL
Let me know if you need Further help...
OHDev
ASKER
ty OHDev, but that still doesn't answer my question: why do I get the error under t98 and not under NT? Where is the limitation to 17? (and why 17? 16 would have sounded more like it, wouldn't it?). You see, the sort-of-chat program is just a propedeutic.. propedeutical.. preparatory! preparatory step to further development, so it's not important in itself, I just wanted to understand WHY that happens. BTW, with an "on error resume next" statement it works fine (to the eye of the user, but we know better LOL) even under 98.
:)
why not try to load the Winsock Controls on Runtime ...
just put one Winsock control on the form and give it an Index of 0
Private Sub Form_Load()
Dim i
On Error GoTo err_h
For i = 0 To MAXSCK
if i<>0 then
Load Sck(i)
sck(i).Parent=Form1
end if
With Sck(i)
.LocalPort = PORT1 + i
.Listen
End With
Next
Exit Sub
err_h:
MsgBox Err.Description, vbCritical, "Socket " & i
Resume Next
End Sub
It may help and it may not :)
about the number of 17 ... I think it's like 16 winsocks have already taken the maximum buffer space so when you try to listen on more it will generate that error ...
I don't really know how to fix this ... Hope you'll get succeeded fixing it :)
OHDev
why not try to load the Winsock Controls on Runtime ...
just put one Winsock control on the form and give it an Index of 0
Private Sub Form_Load()
Dim i
On Error GoTo err_h
For i = 0 To MAXSCK
if i<>0 then
Load Sck(i)
sck(i).Parent=Form1
end if
With Sck(i)
.LocalPort = PORT1 + i
.Listen
End With
Next
Exit Sub
err_h:
MsgBox Err.Description, vbCritical, "Socket " & i
Resume Next
End Sub
It may help and it may not :)
about the number of 17 ... I think it's like 16 winsocks have already taken the maximum buffer space so when you try to listen on more it will generate that error ...
I don't really know how to fix this ... Hope you'll get succeeded fixing it :)
OHDev
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well done, OhDev! That did it! :)
Glad i could be a Help here :)
OHDev
OHDev
-Brian