當我在windows 2008 32位服務器中運行下面的代碼時,當調用connect()時,程序流轉到sckTest_Error()。在連接到Windows 2008中的端口0時出現的不同行爲32/64位
但是當我在Windows中運行相同的代碼,2008年64位服務器,RTE發生和程序流轉到錯誤:
Private Sub Form_Load()
On Error GoTo error1
If (Not (Me.sckTest.State = sckConnected)) Then
'
'Log event for outbound client mode connectoin
If Me.sckTest.State <> sckClosed Then
Me.sckTest.Close
End If
'
MsgBox "Going to connect"
Me.sckTest.Connect "127.0.0.1", 0
MsgBox "Connecting"
If Me.sckTest.State = sckConnected Then
MsgBox "Connected"
End If
'
End If
Exit Sub
error1:
MsgBox "RTE " & Err.Number
End Sub
Private Sub sckTest_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 in connecting" & Number
End Sub
但我得到的錯誤在兩個服務器10049。任何人都可以請我的代碼或服務器行爲的問題。
感謝
你爲什麼試圖連接到端口零? – EJP 2013-02-11 16:57:03