你是用TCP 还是用UDP?
很有可能是SOCK通讯没有连接好,请确认两者初始连接!
将你的代码贴出来看看!

解决方案 »

  1.   

    我也遇见了这种情况,不过另人费解的是在VB中运行就没有问题,生成的EXE文件则会报告126错误。我用的UDP协议,服务器端代码如下:
    Private Sub cmdSend_Click()
       Call udpServer.SendData(txtSend.Text)
       txtOutput.Text = txtOutput.Text & _
          "Send message:" & txtSend.Text & vbCrLf
       txtOutput.SelStart = Len(txtOutput.Text)
       txtSend.Text = ""
    End SubPrivate Sub Form_Load()
        Call udpServer.Bind(5000)
    End SubPrivate Sub Form_Terminate()
       Call udpServer.Close
    End SubPrivate Sub udpServer_DataArrival(ByVal bytesTotal As Long)
       Dim message As String
       Call udpServer.GetData(message)
       txtOutput.Text = txtOutput.Text & vbCrLf & _
          "From:" & udpServer.RemoteHostIP & _
          vbCrLf & "Port #:" & Str$(udpServer.RemotePort) & _
          vbCrLf & "Message:" & message & vbCrLf
       txtOutput.SelStart = Len(txtOutput.Text)
    End Sub