你好,我是Jmp 17 用户。
我有一个 python 脚本,它是一个每 3 秒不断发送短信的服务器。
我正在尝试连接并在 jmp 中接收这些数字。
我使用这个HTTP 请求示例作为参考,但是callbackfn 从未被调用。
callbackfn = function( {x},
write ("Message Recieved");
);
//Create a socket
con = Socket();
//Use a specific port on this computer
con << Bind( "localhost", "8081" );
//Tell this socket to be ready for other sockets to connect to it
Write( "\!nlistening on ", (con << getSockName)[3]);
con << Listen();
//When something connects to this socket, call a function to handle
//the connection. Accept connections for the next 5 minutes.
con << Accept(callbackfn, 30000);
Accept 返回 {“Accept”,“ok”},但是callbackfn 从未被调用。
我编写了不同的 python 客户端脚本来展示我想要做的事情,并且它可以毫无问题地运行。
像这样 -
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
# Connect to the server
client_socket.connect((host, port))
print(f"Connected to {host}:{port}")
while True:
# Receive data from the server
data = client_socket.recv(1024)
if not data:
break
# Print received data
print(f"Received: {data.decode()}")
知道为什么我无法让它在 JMP 上运行吗?除了上面的例子,我找不到任何文档。
谢谢
谢谢您的回复。
我已经检查了脚本指南、脚本索引和示例文件夹,但仍未找到我想要的内容。
我正在尝试找到一种方法,在每次发送时从服务器获取一个数字,现在只打印它,但我不想在等待期间阻止我的 JMP 应用程序。当这可行时,我会用这个数字来更新图表。
我找不到如何像平常一样开始新线程的方法,任何其他来源/方向都会有所帮助
谢谢