简体   繁体   English

使用iOS和嵌入式设备创建UDP连接

[英]creating a UDP connection with iOS and an embeddeddevice

If I have an iOS client and an embedded device that I want to communicate between the two with a WiFi connection using UDP, do I need to write a server (python or something) to facilitate the connection? 如果我有一个iOS客户端和一个嵌入式设备,我想通过UDP通过WiFi连接在两者之间进行通信,我是否需要编写服务器(python或其他工具)来简化连接? I am trying to look online but there are a lot of ambigious articles. 我正在尝试在线查找,但是有很多含糊的文章。

Thanks 谢谢

You'll have to write a server application for the device (iOS or embedded) that will be listening for data. 您必须为要侦听数据的设备(iOS或嵌入式)编写服务器应用程序。

However, for a simple, single-client UDP connection, your server is basically just a UDP socket, which you bind to the port you want to use - and then start listening for data on. 但是,对于简单的单客户端UDP连接,您的服务器基本上只是一个UDP套接字,您将其绑定到要使用的端口上-然后开始侦听数据。 You don't need any connection-handling as UDP is connectionless. 您不需要任何连接处理,因为UDP是无连接的。

On your client, you just send data to the IP and port of your server, and that's it. 在客户端上,您只需将数据发送到服务器的IP和端口即可。

I've done this myself, connecting my iPod Touch to a small ITX computer (running WinXP), to control a small mobile robot over WiFi. 我自己完成了此操作,将iPod Touch连接到小型ITX计算机(运行WinXP),以通过WiFi 控制小型移动机器人

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

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