目前 wsock.dll 在 Excel 2007 中用于连接 TCP 服务器。可以寄东西出去就好了。但是,关于接收,有没有办法让它成为事件驱动的,因为我不知道什么时候有消息发送到 Excel?并且 recv 调用将被阻止,直到有东西到达。
问问题
1268 次
1 回答
1
如果您可以使用 Winsock ActiveX 控件,那么您可以使用基于事件的编程模型。我为 Access 摘录了这个例子:
Private Sub axWinsockServer_DataArrival(ByVal bytesTotal As Long)
Dim strClientMsg As String
' The DataArrival event fires on the server when the client sends
' information. Get the data and display it in a text box.
wsServer.GetData strClientMsg, vbString
Me!Text1.Value = strClientMsg
End Sub
尽管考虑一下为什么,确切地说,您需要一个电子表格来进行网络通信。
于 2013-11-01T03:01:57.157 回答