简体   繁体   English

无法使用TCP / IP连接iPhone和笔记本电脑

[英]Unable to connect iPhone & laptop using TCP/IP

We're attempting to network between an iphone and a computer (windows 7) using TCP/IP over Wifi. 我们试图通过Wifi使用TCP / IP在iphone和电脑(Windows 7)之间进行联网。 We are having a lot of difficulty setting up this basic network and we were hoping to get some guidance. 我们在建立这个基本网络时遇到了很多困难,我们希望得到一些指导。

Server side: 服务器端:

Currently, we are trying to use MATLAB's tcpip protocol to set up the connection on the computer. 目前,我们正在尝试使用MATLAB的tcpip协议在计算机上设置连接。 We have determined the IP addresses of the phone and the computer and we picked a port number (501), that we are trying to read and write from. 我们确定了手机和计算机的IP地址,然后我们选择了一个端口号(501),我们正在尝试读取和写入。 We allowed that port number in windows firewall. 我们允许Windows防火墙中的端口号。

In simulink we set up a TCP/IP send block to send out a constant, by double-clicking on that block and selecting the "verify address and port connectivity" button we get the error message: 在simulink中我们设置一个TCP / IP发送块来发送一个常量,通过双击该块并选择“验证地址和端口连接”按钮,我们得到错误消息:

"The remote address '140.180.....' has been found. However, we are unable to connect to the server at the specified port. “已找到远程地址'140.180 .....'。但是,我们无法连接到指定端口的服务器。

Specify a different port or wait for the current port to become available" 指定其他端口或等待当前端口变为可用“

We have tried other port numbers, but gotten the same message. 我们尝试了其他端口号,但得到了相同的消息。

We have tried using an ad hoc connection between the computer and the iphone to the same effect. 我们尝试在计算机和iphone之间使用ad hoc连接达到相同的效果。

We have also tried other MATLAB scripts to set up the connection (eg http://www.mathworks.com/matlabcentral/fileexchange/24524 ) but we always get and error in the connection 我们还尝试了其他MATLAB脚本来建立连接(例如http://www.mathworks.com/matlabcentral/fileexchange/24524 ),但我们总是得到连接错误

Finally, we tried sending and receiving info over TCP/IP with the same computer using two MATLAB instances running in parallel, but we generally get the same error message. 最后,我们尝试使用两个并行运行的MATLAB实例在同一台计算机上通过TCP / IP发送和接收信息,但我们通常会收到相同的错误消息。

We even tried UDP...no dice. 我们甚至尝试过UDP ......没有骰子。

Client side (iphone) 客户端(iphone)

We're using NSStream exactly as per this tutorial: http://www.devx.com/wireless/Article/43551/1954 我们完全按照本教程使用NSStream: http//www.devx.com/wireless/Article/43551/1954

The stream is opened upon a toggle action, and we immediately send a string to the server. 在切换操作时打开流,我们立即将字符串发送到服务器。 We also tried sending a continuous sequence of data with the run loop. 我们还尝试使用运行循环发送连续的数据序列。 One strange bit of behavior is that, after the stream is open for a little while (~1 min), the handleEvent method does seem to get triggered (implying something is received from the server??) because we get a log message corresponding to case NSStreamEventErrorOccurred. 一个奇怪的行为是,在流打开一段时间后(约1分钟),handleEvent方法似乎确实被触发(暗示从服务器收到了什么?)因为我们得到一条对应的日志消息case NSStreamEventErrorOccurred。

We think the issue lies on the server side, but really don't know enough to be sure or to debug properly. 我们认为问题出在服务器端,但实际上还不足以确定或正确调试。 Any help would be very much appreciated. 任何帮助将非常感谢。

A long overdue answer to this one: don't network with Windows. 这个问题早就应该回答:不要与Windows联网。 We eventually thought to switch over to a mac and lo and behold everything worked properly. 我们最终想到切换到mac和lo,看看一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM