Ok, I have visual Studio 6 Enterprise Edition, I have service pack 6 and sp6 runtimes, my OS is XP Pro sp2. I've posted in several forums, tried the programming rooms at yahoo... I don't seem to be getting anywhere.
Here's my problem, I made a client - server app, it's not a rat but just a simple one way text messenger. Cool lookin progress bars an such, most of the code is graphical in nature, alot of wait states for the fakie progress bar. Aside from that my connection routines are simple, with status shown on labels.
The code compiles fine, but when I try to run it, i get two errors, (one obviously because of the other)
Error1 (40006) Wrong protocol or connection state for the requested transaction or request.
Error2 (10038) (The descriptor is not a socket) in Procedure Ws1_ConnectionRequest of form frmServer.
So far in the last 2 days I have (besides not getting any sleep) Tried unregistering and reinstalling MSWINSCK.OCX, doing the same with an earlier version of the control(can't find a newer one), completely uninstalling Visual Studio and all related componts and then reinstalling, I've tried with and without the service pack and, I've tried it with no other connections active on my machine and on 7 different ports which are all listed as unreserved/unused ports.
The listen state for the winsock shows on netstat however, but if i try to SendData it gives the errors.
I don't want to have to use CSocket exclusively, and all my projects are pretty much stalled without Winsock.
I'm sure my code is good but I'm puttin it here anyway just in case, any help or comments at all would be greatly appreciated. Help me guys...
... before I lose my marbles completely, lol!
If RData = "confirmrequest" And Ws1.State = sckConnected Then
Ws1.SendData (confirmed)
Else
Timer1.Enabled = True
End If
On Error GoTo 0
Exit Sub
Ws1_DataArrival_Error:
MsgBox "Error2 " & Err.Number & " (" & Err.Description & ") in procedure Ws1_DataArrival of Form frmServer"
End Sub
CLIENT
VB Code:
Dim errorint As Integer
Dim prog1 As Integer
Dim waitstate As Integer
Dim waitstate2 As Integer
Private Sub exitButton_Click()
End
End Sub
Private Sub Form_Load()
errorint = 0
prog1 = 0
waitstate = 0
Timer2.Enabled = False
End Sub
Private Sub Timer1_Timer()
If prog1 = 990 Then
Timer1.Enabled = False
Timer2.Enabled = True
Else
PBar.Value = prog1
prog1 = prog1 + 10
End If
End Sub
Private Sub Timer2_Timer()
If errorint = 20 Then
Call MsgBox("Unable to create an active connection within Pager, this is not due to the admin server being offline. Please report this error to the administrator at [email][email protected][/email]", vbCritical, "Failed...")
End
End If
If waitstate = 5 Then
PBar.Value = 1000
Ws1.Close
Ws1.RemoteHost = "127.0.0.1"
Ws1.Connect
SendingData:
If Ws1.State <> sckBadState And Ws1.State <> sckWrongProtocol Then
Dim DeltaData As String
DeltaData = confirmrequest
Ws1.SendData DeltaData
Else
lbl1.Caption = "Retrying"
Ws1.Close
Ws1.Connect
GoTo SendingData
errorint = errorint + 1
End If
If waitstate = 5 Then Timer2.Enabled = False
Else
waitstate = waitstate + 1
End If
End Sub
Private Sub Ws1_DataArrival(ByVal bytesTotal As Long)
On Error GoTo Ws1_DataArrival_Error
RData = confirmation
Ws1.GetData RData
If confirmation = "confirmed" Then
lbl1.Caption = "Connection Established"
titlelbl.Caption = "Success!"
Timer3.Enabled = True
End If
On Error GoTo 0
Exit Sub
Ws1_DataArrival_Error:
lbl1.Caption = "The admin appears to be offline."
titlelbl.Caption = "Failed..."
exitButton.Visible = True
End Sub
Private Sub Timer3_Timer()
waitstate2 = 0
If waitstate2 = 2 Then
lbl1.Caption = "Authenticating..."
End If
If waitstate2 = 4 Then
lbl1.Caption = "Confirmed... Building Interface..."
Thanks for answering Pino, I can't post the compiled app becuase then it won't work for any one, I don't believe it is the code, I think it is an error in my winsock, but I've repalced it several times. I have the source here for you, full project files. And I know what that error means, I only included it because it was the initial error, the true error is the not a socket eror but it was only returned after adding an error handler to report it. The connection error is a byproduct of the socket error.