热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

CodenameOneSockets向客户发送消息-CodenameOneSocketsSendMessagetoClient

iwanttowriteasimpleAppforme(Android).Forthisitisnecessarythattheservercansenddat

i want to write a simple App for me (Android). For this it is necessary that the server can send data to my client (only one client at a time) but unfortunately i have no idea how to use sockets or websockets with codename one. Can someone please post a small examplecode how to establish connection, listen on it and send some small data?

我想为我写一个简单的应用程序(Android)。为此,服务器必须能够将数据发送到我的客户端(一次只能有一个客户端),但不幸的是我不知道如何使用代号为1的套接字或websockets。有人可以发一个小示例代码如何建立连接,听取它并发送一些小数据?

greetings

Captain

2 个解决方案

#1


3  

You need to use the cn1lib from Steve Hannah to access websockets. Its available here: https://github.com/shannah/cn1-websockets

您需要使用Steve Hannah的cn1lib来访问websockets。它可以在这里找到:https://github.com/shannah/cn1-websockets

Found thru looking at https://www.codenameone.com/cn1libs.html

通过查看https://www.codenameone.com/cn1libs.html找到

Sockets are a bit problematic though, you might want to look at push, pubnub or just https if applicable. See the chat app demo parts 5 & 6 for the former: https://www.codenameone.com/blog/building-a-chat-app-with-codename-one-part-5.html

套接字有点问题,你可能想看看push,pubnub或只是https(如果适用)。请参阅前者的聊天应用程序演示部分5和6:https://www.codenameone.com/blog/building-a-chat-app-with-codename-one-part-5.html

#2


0  

have a look at this example code: https://towhidz.wordpress.com/2012/03/03/simple-chat-applicationclient-server-in-android/ Google is your friend

看看这个示例代码:https://towhidz.wordpress.com/2012/03/03/simple-chat-applicationclient-server-in-android/ Google是你的朋友


推荐阅读
author-avatar
陈氏女子2602926065
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有