Failed to connect iPhone and laptop using TCP / IP

We are trying to establish a connection between iphone and computer (Windows 7) using TCP / IP over wifi. We were having difficulty getting this basic network set up and hoping to get some guidance.

Server side:

We are currently trying to use MATLAB tcpip protocol to set up a connection on a computer. We have identified the IP addresses of the phone and computer and we have selected the port number (501) that we are trying to read and write. We have allowed this port number in Windows Firewall.

In simulink, we configured a TCP / IP send block to send a constant, by double clicking on this block and selecting the "Check address and port connection" button, we get an error message:

The "remote address" 140.180 ..... "was found. However, we cannot connect to the server on the specified port.

Specify a different port or wait for the current port to become available.

We tried different port numbers but got the same message.

We tried to use peer-to-peer connection between computer and iphone with the same effect.

We also tried other MATLAB scripts to set up the connection (e.g. http://www.mathworks.com/matlabcentral/fileexchange/24524 ), but we always get a connection error too

Finally, we tried to send and receive information over TCP / IP with the same computer, using two MATLAB instances that run in parallel, but we usually get the same error message.

We even tried UDP ... no dice.

Client side (iphone)

We are using NSStream exactly according to this guide: http://www.devx.com/wireless/Article/43551/1954

The stream is opened on switch and we immediately send the string to the server. We also tried to send a continuous sequence of data with a start loop. One strange bit of behavior is that after the stream has been open for a while (~ 1 min) the handleEvent method seems to fire (assuming something was received from the server ??) because we are receiving a log message corresponding to case NSStreamEventErrorOccurred.

We think the problem is on the server side, but it's really not enough to know to be sure or to debug properly. Any help would be very much appreciated.

+3


source to share


1 answer


Long-term answer to this question: Don't connect to Windows. We finally decided to switch to Mac, and now everything is working correctly.



+1


source







All Articles