Dim linked As Boolean
Dim thestep As Integer
Dim password As String
Dim userid As String
Dim pop3 As StringPrivate Sub cmdbeg_Click()
Dim i
On Error GoTo dothat
pop3 = txtip.Text
txton = "正连接"
'ip
Winsock1.RemoteHost = pop3
'端口号
Winsock1.RemotePort = 110
Winsock1.Connect
'可能陷入四循环
txton = 已连接
Do While Winsock1.State <> 7
i = DoEvents
Loop
GoTo dogoon
Exit Sub
dothat:
     MsgBox "没连接"
     txton = "连接错误"
dogoon:
     linked = True
End Sub
Private Sub Form_Load()
linked = False
txton = "未登陆到服务器"
thestep = 0
End SubPrivate Sub Timer1_Timer()
Dim i
If Not lincked Then
On Error GoTo dothat
pop3 = txtip
txton = "正在连接"
Winsock1.RemoteHost = "192.168.0.2"
Winsock1.RemotePort = 110
Winsock1.Connect
Do While Winsock1.State <> 7
i = DoEvents()
Loop
GoTo dogoon
dothat:
     MsgBox "错误"
     txton = "连接错误"
dogoon:
     linked = True
End If
End SubPrivate Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim i
Dim s As String
Dim strs As String
Winsock1.GetData s
MsgBox s
text2 = s
' MsgBox thestep
Select Case thestep
Case 0
  If Left(text2, 3) = "+OK" Then
  userid = txtuser
  Winsock1.SendData "USER" & userid & vbCrLf '& Chr$(10) & Chr$(13)
  thestep = thestep + 1 '& vbCrLf
  txton = "发送userid...."
  Else
  Winsock1.Close
  Do While Winsock1.State <> 0
     i = DoEvents()
  Loop
  MsgBox "登不上..."
  linked = False
  thestep = 0
  End If
Case 1
  strs = s
  If Left(strs, 3) = "+OK" Then
     password = txtpsw
     s = "PASS" & password & vbCrLf ' & Chr$(10) & Chr$(13)
     Winsock1.SendData "PASS" & password & vbCrLf
     thestep = thestep + 1
     txton = "发送password......"
  Else
     Winsock1.Close
     Do While Winsock1.State <> 0
        i = DoEvents()
     Loop
     MsgBox "账户不对..."
     linked = False
     txton = "账户错误"
     thestep = 0
 End If
 Case 2
     strs = s
     Dim n1 As Integer
     Dim n2 As Integer
     Dim num As Integer
          If Left(s, 3) = "+OK" Then
        n1 = InStr(s, "has")
        n2 = Len(Mid(s, InStr(s, "message")))
        s = Mid(strs, n1 + 3, Len(s) - n1 - 3 - n2)
        s = Trim(s)
        num = s
        txton = "关闭连接"
        If num > 0 Then
            txton = "您有" & s & "封信"
        End If
        Winsock1.Close
        Do While Winsock1.State <> 0
        Loop
            i = DoEvents()
        linked = False
        thestep = 0
    
    Else
        Winsock1.Close
        Do While Winsock1.State <> 0
            i = DoEvents()
        Loop
        'MsgBox num
        MsgBox "用户口令不对"
        linked = False
        thestep = 0
        txton = "口令错误"
    End If
End Select
End Sub
总是提示口令错误,我实在找不出错在哪里!!登录的user&pass均正确!!!