|
-
Jan 25th, 2009, 09:08 PM
#1
Thread Starter
New Member
Help me please , winsock control error
I am new to this forum, i am looking for a place that can help me learn VB better, im using visual basic 6, im teaching myself , so far the only thing ive had trouble with is winsock controls, for example, im making a program for a game, it will have a login and all that, but first before the login it checks the version, this is my code
Code:
Private Sub Form_Load()
Me.Width = 2540
Me.Height = 570
On Error GoTo t
sock1.Close
sock1.RemoteHost = "98.229.92.252"
sock1.RemotePort = "1649"
sock1.Connect
Dim version As String
version = "VersionCheck"
sock1.SendData version
Exit Sub
t:
MsgBox "Error : " & Err.Description, vbCritical
End Sub
Private Sub sock1_Close()
sock1.Close
End Sub
Private Sub sock1_Connect()
MsgBox "Made connection to server"
End Sub
Private Sub sock1_DataArrival(ByVal bytesTotal As Long)
Dim Dat As String
sock1.GetData Dat, vbString
If Dat = Me.Caption Then
Timer1.Enabled = False
Label1.Caption = ""
lbl1.Caption = "Connected"
MsgBox "Welcome to the Otown community"
Load frmlogin
sock1.Close
Timer1.Enabled = False
Else
sock1.Close
Timer1.Enabled = False
MsgBox "Invalid version, Please get the latest version of The Otown community and uninstall this version", vbCritical, "Invalid version"
Unload frmlogin
Unload frmOtown
Unload frmVersionCheck
End If
End Sub
Private Sub sock1_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 "Please contact Ovhan for the matter on error:" & vbCrLf & Number & vbCrLf & Description
sock1_Close
sock1.RemoteHost = "98.229.92.252"
sock1.RemotePort = "1649"
sock1.Listen
End Sub
Private Sub Timer1_Timer()
Static loadcycle As Integer
loadcycle = loadcycle + 1
If loadcycle < 1 Or loadcycle > 3 Then
loadcycle = 1
End If
If loadcycle = 1 Then
Label1.Caption = "."
ElseIf loadcycle = 2 Then
Label1.Caption = ".."
ElseIf loadcycle = 3 Then
Label1.Caption = "..."
loadcycle = 0
End If
End Sub
thats the code for my client which is the problem , and i know theres alot of noob code in there and stuff =P i just dont feel like doing anything over done , anyways when i do this i get the error , "error: Wrong protocal or connection state for the requested transaction or request." what could be wrong?
ps. if anyone has any suggestions for this besides what i got please tell me. i could use any help i could get =P tyvm!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|